Skip to content

Dotty Type Erasure for Scala 2 is wrong for Array[Null] and Array[Nothing] #22515

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hamzaremmal opened this issue Feb 4, 2025 · 0 comments · Fixed by #22517
Closed

Dotty Type Erasure for Scala 2 is wrong for Array[Null] and Array[Nothing] #22515

hamzaremmal opened this issue Feb 4, 2025 · 0 comments · Fixed by #22517

Comments

@hamzaremmal
Copy link
Member

hamzaremmal commented Feb 4, 2025

Compiler version

3.0.0-3.6.3

Minimized code

Compile Foo with Scala 2:

//> using scala 2.13.16
object Foo {
    def a: Array[scala.Nothing] = ???
}

Then use the classfiles from Scala 2 when compiling the second file with Scala 3

//> using scala 3.6.3
@main def Test = Foo.a

Output

Exception in thread "main" java.lang.NoSuchMethodError: 'scala.runtime.Nothing$[] Foo$.a()'
	at playground$package$.Test(playground.scala:1)
	at Test.main(playground.scala:1)

Expectation

Work at runtime. The issue was introduced by #11846

Notes

Same if we have in the return type Array[scala.Null]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants