While being experimental, the Scala community has largely adopted the Scala 2 Def Macro feature in multiple of ways: code generation, optimizations, ergonomic DSLs...
A large part of the ecosystem now depends on Scala 2.13 macros defined in external libraries. Identifying those library dependencies is key to establish that a project is ready to be migrated to Scala 3.0.
The Scala 3.0 compiler cannot execute Scala 2.13 macro definitions.
However, the handy
-Xignore-scala2-macrosoption can be used to ignore them and type check the rest of the code.
[error] -- Error: /src/main/scala/foo/Foo.scala:10:45 [error] 10 | implicit val foo: Foo[List[Int]] = Foo.make [error] | ^ [error] |Scala 2 macro cannot be used in Scala 3. See https://dotty.epfl.ch/docs/reference/dropped-features/macros.html [error] |To turn this error into a warning, pass -Xignore-scala2-macros to the compiler
-Xignore-scala2-macroswill produce bytecode that will fail at runtime.
The following table contains an incomplete list of macro libraries and their migration status.
Macro Annotations Libraries
Macro annotations are not supported in Scala 3. The following table contains a incomplete list of Scala 2.13 libraries that provide macro annotations. Scala 3.0 compatible alternatives are proposed when available.
|typelevel/simulacrum||Source generation using simulacrum-scalafix|