0

I've got a simple code in Scala to try simulacrum lib:

import simulacrum._
@typeclass trait Semigroup[A] {
  @op("|+|") def append(x: A, y: A): A
}

But this doesn't work. Compiler says

Error:(3, 2) macro implementation not found: macroTransform (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them) @typeclass trait Semigroup[A] {

What can cause this error? I do not create a macro, I just reuse an existing one.

My build.sbt file is simple:

name := "Macr"
version := "0.1"
scalaVersion := "2.12.5"
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
libraryDependencies += "com.github.mpilquist" %% "simulacrum" % "0.12.0"
Stas
  • 1,040
  • 7
  • 7

1 Answers1

1

As noted by Oleg Pyzhcov in the comments, macros don't work with Scala 2.12.4 and 2.12.5 when compiling on Java 9 or 10. However, this has been fixed in Scala 2.12.6, so upgrading should solve the problem.

Brian McCutchon
  • 8,354
  • 3
  • 33
  • 45