Files
kotlin-fork/compiler/testData/codegen/box/javaInterop/notNullAssertions/extensionReceiverParameter.kt
T
Mikhail Glukhikh d1fac6dce1 FIR2IR: declare receivers for all accessors of extension properties
Before this commit, extension receivers were declared only for
properties with container source, which is strange & inconsistent.
Now we declare accessor extension receiver iff corresponding property
has extension receiver.
2020-02-25 12:13:42 +03:00

32 lines
564 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// FILE: Test.java
public class Test {
public static String invokeFoo() {
try {
ExtensionKt.foo(null);
}
catch (NullPointerException e) {
try {
ExtensionKt.getBar(null);
}
catch (NullPointerException f) {
return "OK";
}
}
return "Fail: assertion must have been fired";
}
}
// FILE: extension.kt
fun Any.foo() { }
val Any.bar: String get() = ""
fun box(): String {
return Test.invokeFoo()
}