programming-scala-book-code-examples
programming-scala-book-code-examples copied to clipboard
[error] -- Error: D:\ScalaProject\programming-scala-book-code-examples\src\main\scala\progscala3\typesystem\bounds\list\AbbrevList.scala:36:17
sbt:programming-scala-3rd-ed-code-examples> run hello world [info] compiling 136 Scala sources and 4 Java sources to D:\ScalaProject\programming-scala-book-code-examples\target\scala-3.1.2\classes ... [error] -- Error: D:\ScalaProject\programming-scala-book-code-examples\src\main\scala\progscala3\typesystem\bounds\list\AbbrevList.scala:36:17 [error] 35 |@targetName("AbbrevListCons") [error] 36 |final case class ::[B](private var hd: B, [error] |^ [error] |@targetName annotation "AbbrevListCons" clashes with other definition in same scope [error] 37 | private[list] var tl: AbbrevList[B]) extends AbbrevList[B]: [error] 38 | override def isEmpty: Boolean = false [error] 39 | def head : B = hd [error] 40 | def tail : AbbrevList[B] = tl [error] one error found [error] (Compile / compileIncremental) Compilation failed [error] Total time: 11 s, completed Aug 5, 2022 10:24:43 AM
Same issue
I think I know why this is happening. I'll fix later today, but if you just want to change the string, for example, to AbbrevListCons2
, the error should go away.
Try starting sbt and then running clean
, then run hello world
. I believe there may be an old class file found in the previous compilation output that is causing problems. Also, make sure you have the pulled the latest code from the repo. I fixed something similar to this a while ago. Let me know if this "fixes" it.
Yep, works on my end. Thx.
Closing...