bug icon indicating copy to clipboard operation
bug copied to clipboard

Certain concrete type projections written in Scala 3 can't be used in Scala 2

Open jadenPete opened this issue 5 months ago • 1 comments

Reproduction steps

Scala 2 version: 2.13.16 Scala 3 version: 3.6.3

  1. Clone this minimum reproducability case: https://github.com/jadenPete/scala-type-projection-bug-reproduction

  2. Run sbt compile

  3. 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.

jadenPete avatar Aug 12 '25 14:08 jadenPete

we should at least evaluate this for 2.13.17. cc @bishabosha

SethTisue avatar Aug 19 '25 09:08 SethTisue