programming-scala-book-code-examples icon indicating copy to clipboard operation
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

Open nicolast0604 opened this issue 2 years ago • 4 comments

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

nicolast0604 avatar Aug 05 '22 02:08 nicolast0604

Same issue

germatpreis avatar Aug 05 '22 13:08 germatpreis

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.

deanwampler avatar Aug 05 '22 15:08 deanwampler

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.

deanwampler avatar Aug 05 '22 18:08 deanwampler

Yep, works on my end. Thx.

germatpreis avatar Aug 07 '22 18:08 germatpreis

Closing...

deanwampler avatar Feb 14 '23 23:02 deanwampler