[Test] Properly merge box against java testdata into codegen/box
Previous commit about it was 3199ce03 and it was completely wrong
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// DONT_TARGET_EXACT_BACKEND: JS JS_IR JS_IR_ES6 WASM NATIVE
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// MODULE: lib
|
||||
// FILE: RightElvisOperand.java
|
||||
|
||||
class RightElvisOperand {
|
||||
static String foo() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: 1.kt
|
||||
|
||||
fun baz(): String? = null
|
||||
|
||||
fun bar(): String = baz() ?: RightElvisOperand.foo()
|
||||
|
||||
fun foo(x: String) {}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
foo(baz() ?: RightElvisOperand.foo())
|
||||
return "Fail: should have been an exception in `foo(baz() ?: RightElvisOperand.foo())`"
|
||||
}
|
||||
catch(e: NullPointerException) {}
|
||||
|
||||
try {
|
||||
bar()
|
||||
return "Fail: should have been an exception in `bar()`"
|
||||
}
|
||||
catch(e: NullPointerException) {
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user