I ran into a crazy Scala/Dotty/SBT compiler error just now. It turns out that when you use SBT with Dotty, you can’t use the name “givens” for a package name, as shown by this error message:
[info] Compiling 1 Scala source to /foo/target/scala-0.24/classes ... [error] -- [E007] Type Mismatch Error: /foo/src/main/scala/givens/Givens2.scala:3:0 [error] 3 |@main def makeItSo = [error] |^^^^^ [error] |Found: givens.main [error] |Required: scala.annotation.Annotation [error] one error found [error] (Compile / compileIncremental) Compilation failed [error] Total time: 0 s, completed May 27, 2020, 1:46:17 PM
I know that
given is a Scala 3 keyword, but I didn’t think using the name givens in the package name would be a problem. The code compiles fine with
dotc, so it’s not a Dotty thing, at least not a Dotty standalone thing. It has something to do with using SBT with Dotty. That was a crazy way to spend fifteen minutes. This error happens when using SBT with Dotty 0.24 in late May, 2020.