bug
bug copied to clipboard
Certain concrete type projections written in Scala 3 can't be used in Scala 2
Reproduction steps
Scala 2 version: 2.13.16 Scala 3 version: 3.6.3
-
Clone this minimum reproducability case: https://github.com/jadenPete/scala-type-projection-bug-reproduction
-
Run
sbt compile -
Observe the following compilation error:
[error] .../scala2/Scala2.scala:6:23: type mismatch;
[error] found : Scala3#InnerClass
[error] required: Scala3.this.InnerClass
[error] ThingDoer.doThing(inner)
[error] ^
[error] one error found
Problem
I'd expect this to compile, since ThingDoer.doThing expects a Scala3#InnerClass, which is the type of inner. I'm not even sure what the Scala3.this.InnerClass type is, since that only seems to make sense within the context of Scala3, not ThingDoer. This works if Scala2.scala is compiled with Scala 3, indicating that this is probably an issue with Scala 2's TASTy reader.
we should at least evaluate this for 2.13.17. cc @bishabosha