JVM, JVM IR: Don't optimize null-checks based on nullability information
Since Java interop allows us to circumvent the Kotlin type system we cannot rely on nullability information.
This commit is contained in:
committed by
Alexander Udalov
parent
de082543f1
commit
b80e157381
@@ -0,0 +1,18 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: Unsound.java
|
||||
|
||||
import test.Wrap;
|
||||
|
||||
public class Unsound {
|
||||
public static <T> Wrap<T> get() {
|
||||
return new Wrap<T>(null);
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
class Wrap<T>(val x: T)
|
||||
|
||||
fun box(): String = if ((Unsound.get<String>() as Wrap<String>).x == null) "OK" else "Fail"
|
||||
Reference in New Issue
Block a user