Skip to content

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

Closed
@hamzaremmal

Description

@hamzaremmal

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]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions