Skip to content

Certain type aliases written in Scala 3 can't be used in Scala 2 #13113

@jadenPete

Description

@jadenPete

Reproduction steps

Scala 2 version: 2.13.16
Scala 3 version: 3.6.3

  1. Clone this minimum reproducability case repository:
    https://github.com/jadenPete/scala-missing-from-classpath-bug-reproduction

  2. Run sbt compile

  3. Observe the following error:

[error] .../scala-missing-from-classpath-bug-reproduction/program/src/main/scala/Main.scala:8:18: Symbol 'type com.example.package.AnimalList' is missing from the classpath.
[error] This symbol is required by 'object com.example.Person'.
[error] Make sure that type AnimalList is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'Person.class' was compiled against an incompatible version of com.example.package.
[error]     val mickey = Person(pets = List(goofy))
[error]                  ^
[error] one error found

Problem

Certain type aliases written in Scala 3 can't be transitively used by other Scala 2 targets (i.e. referenced in a Scala 2 target that, in turn, is depended on by another Scala 2 target). I'm not sure if this is specific to package objects, but something gets lost in translation when those Scala 3 type aliases are encoded in Scala 2's Pickle format instead of decoded directly from TASTy.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions