FIR: Adjust testData for spec tests: invoke on nullable receiver
It's a design problem, see related issue ^KT-30415
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
class A {
|
||||
operator fun invoke() {}
|
||||
}
|
||||
|
||||
class B {
|
||||
val bar: () -> Unit = {}
|
||||
val foo: A = A()
|
||||
}
|
||||
|
||||
fun main(b: B?) {
|
||||
b?.bar() // allowed in FIR, prohibited in old FE
|
||||
b?.foo() // allowed in FIR, prohibited in old FE
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
FILE: safeCallInvoke.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final operator fun invoke(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final class B : R|kotlin/Any| {
|
||||
public constructor(): R|B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val bar: R|() -> kotlin/Unit| = fun <anonymous>(): R|kotlin/Unit| {
|
||||
^ Unit
|
||||
}
|
||||
|
||||
public get(): R|() -> kotlin/Unit|
|
||||
|
||||
public final val foo: R|A| = R|/A.A|()
|
||||
public get(): R|A|
|
||||
|
||||
}
|
||||
public final fun main(b: R|B?|): R|kotlin/Unit| {
|
||||
R|<local>/b|?.R|/B.bar|?.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
|
||||
R|<local>/b|?.R|/B.foo|?.R|/A.invoke|()
|
||||
}
|
||||
Reference in New Issue
Block a user