Is there any tool to rewrite implicits to givens/using?

Hi! I’am migrating a big project (100k lines+) to Scala 3 and I want to rewrite it to new syntax. I found rewrites for some things, but didn’t found anything related to implicits.
Is there a way to rewrite those automatically?

Scalafix.
You can create your own rules or try to use existing ones created by the community - this one seems to do the job (but I’ve never used it) - GitHub - arktekk/scala3-scalafix

Also, you should remember that the semantics of implicit vs given/using might be slightly different (although I don’t think it’s documented anywhere).
One of the things that bit me during codebase migration was the fact that given is internally similar to implicit lazy val. This was leading to very surprising crashes eg. Compiler crash under combination of value class, lazy vals, macros and derivation · Issue #20323 · scala/scala3 · GitHub or Compiler crashes when combining lazy val and macros · Issue #21271 · scala/scala3 · GitHub
Luckily these are fixed in the last versions of Scala Next

4 Likes

Thank you!