Files
kotlin-fork/compiler/testData/codegen/box/boxingOptimization/kt19767_3.kt
T
Zalim Bashorov f9809d5a73 Minor: replace IGNORE_BACKEND with TARGET_BACKEND for the test what should be run only on JVM
The test was written to check the case for Platform Types which now exists only on JVM.
2017-10-20 21:02:10 +03:00

34 lines
539 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// FILE: M.java
public class M {
private final Integer value;
public M(Integer value) {
this.value = value;
}
public Integer nulled() {
return value;
}
}
// FILE: Kotlin.kt
fun foo(p: Int?): Boolean {
return M(p)?.nulled() == 1
}
fun foo2(p: Int?): Boolean {
return 1 == M(p)?.nulled()
}
fun box(): String {
if (foo(null)) return "fail 1"
if (!foo(1)) return "fail 2"
if (foo2(null)) return "fail 1"
if (!foo2(1)) return "fail 2"
return "OK"
}