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
It doesn't seems to happen with similar Scala code:
abstract class Buffer {
def slice(): Buffer
}
abstract class CharBuffer extends Buffer {
override def slice(): CharBuffer
}
class test {
val a: CharBuffer = null
val b = a.slice()
}
The text was updated successfully, but these errors were encountered:
molikto
changed the title
.asInstanceOf is unnecessarily generated
When overrided function return type subtypes parent type in Java, generated Java bytecode is wrong
Jan 10, 2020
The CharBuffer example can only be reproduced in Java 9 or superior as previous versions did not have a slice() method in the base class Buffer. This might or might not be related to #6546, /cc @anatoliykmetyuk
When trying to make this Scala.js test works in Dotty https://github.com/scala-js/scala-js/blob/master/test-suite/shared/src/test/scala/org/scalajs/testsuite/javalib/io/ReadersTest.scala#L63
Scala.js linker fails with
I found that the IR generated is different
in Dotty:
in Scala 2.13:
minimized code
This is minimized code:
The class file seems have wrong type in it's constant pool, and will have a
checkcast
instruction; see bytecode bellow:Compilation output
This is Tasty file (seems no cast is present here):
Compilation output
It doesn't seems to happen with similar Scala code:
The text was updated successfully, but these errors were encountered: