You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class GBTree[B] {
class Tree[A, B]; class Node[A, B](value: Node[A, B]) extends Tree[A, B]
case class B[A, B]() extends Tree[A, B]
}
$ dotc abc.scala
-- Error: abc.scala ------------------------------------------------------------
3 | case class B[A, B]() extends Tree[A, B]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| B is already defined as type B
exception occurred while typechecking abc.scala
exception occurred while compiling abc.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: symbol (method companion$module) entered the scope of non-class owner type B
at scala.Predef$.assert(Predef.scala:165)
at dotty.tools.dotc.core.Symbols$Symbol.entered(Symbols.scala:429)
at dotty.tools.dotc.typer.Namer.dotty$tools$dotc$typer$Namer$$createLinks$1(Namer.scala:518)
at dotty.tools.dotc.typer.Namer$$anonfun$createCompanionLinks$1$2.apply(Namer.scala:525)
at dotty.tools.dotc.typer.Namer$$anonfun$createCompanionLinks$1$2.apply(Namer.scala:522)
at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:778)
at scala.collection.mutable.HashMap$$anon$2$$anonfun$foreach$3.apply(HashMap.scala:108)
at scala.collection.mutable.HashMap$$anon$2$$anonfun$foreach$3.apply(HashMap.scala:108)
<snipped>
The text was updated successfully, but these errors were encountered:
I think this one is as intended, but we need to spec it. It's clearly very dubious code to have a parameter of a class with the same name as a type member.
scalac compiles but dotc crashes.
$ cat abc.scala
$ dotc abc.scala
The text was updated successfully, but these errors were encountered: