Files
kotlin/compiler/testData/codegen/box/javaInterop/notNullAssertions/destructuringAssignmentWithNullabilityAssertionOnExtensionReceiver_lv12.kt
Dmitry Petrov a284f9d28b Minor: move nullability assertion tests javaInterop/notNullAssertions
(cherry picked from commit 5c62a14)
2017-10-24 16:03:23 +03:00

28 lines
570 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// WITH_RUNTIME
// FILE: test.kt
// LANGUAGE_VERSION: 1.2
import kotlin.test.*
var component1Evaluated = false
// NB extension receiver is nullable
operator fun J?.component1() = 1.also { component1Evaluated = true }
private operator fun J.component2() = 2
fun use(x: Any) {}
fun box(): String {
assertFailsWith<IllegalArgumentException> {
val (a, b) = J.j()
}
if (!component1Evaluated) return "component1 should be evaluated"
return "OK"
}
// FILE: J.java
public class J {
public static J j() { return null; }
}