You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exception in thread "main" java.lang.ClassCastException:classjava.lang.String cannot be cast to classscala.runtime.Nothing$ (java.lang.String is in module java.base of loader 'bootstrap'; scala.runtime.Nothing$ is in unnamed module of loader 'app')
at java.base/java.util.Collections$SingletonList.forEach(Collections.java:4966)
at Foo.copyElements(Test.scala:12)
at Test$package$.Test(Test.scala:19)
at Test.main(Test.scala:17)
Output (javap)
public classFoo<E> {
public Foo();
public void copyElements(java.util.Collection<?extendsE>);
public void addLast(E);
privatefinal void copyElements$$anonfun$1(scala.runtime.Nothing$); // << illegal
}
Output (-Xprint:typer)
[syntax trees at end of typer]] // /Users/wmazur/projects/scala-native/sandbox/src/main/scala/Test.scalapackage<empty> {
importjava.util.Collectionimportjava.util.CollectionsclassFoo[E>:Nothing<:Any]() extendsObject() {
EdefcopyElements(c: java.util.Collection[?>:Nothing<:Foo.this.E]):Unit=
{
c.forEach(
{
def$anonfun(_$1: Nothing):Unit=this.addLast(_$1) // << illegal
closure($anonfun:java.util.function.Consumer[c.T])
}
)
}
defaddLast(e: Foo.this.E):Unit= println(e)
}
...
Expectation
Should infer to correct type, that is AnyRef/java.lang.Object
public classFoo<E> {
public Foo();
public void copyElements(java.util.Collection<?extendsE>);
public void addLast(E);
privatefinal void copyElements$$anonfun$1(java.lang.Object);
}
The text was updated successfully, but these errors were encountered:
Regression found when testing Scala Native runtime with 3.4.0-RC1
Compiler version
3.4.0-RC1
3.3.2-RC1
First bad release: 3.3.2-RC1-bin-20230715-4851278-NIGHTLY
Bisect points to 89735d0
Minimized code
Output (runtime)
Output (javap)
Output (-Xprint:typer)
Expectation
Should infer to correct type, that is AnyRef/java.lang.Object
The text was updated successfully, but these errors were encountered: