Files
kotlin-fork/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/ThisSuper.fir.kt
T
simon.ogorodnik 34e6649d31 [FIR] Harden check of argument type properly
Before this commit, nullable argument could match not null parameter.
Now we require also correct nullability that breaks some cases
2020-02-03 16:45:18 +03:00

22 lines
474 B
Kotlin
Vendored

open class Base {
fun bar(x: Int): Int = x + 1
}
class Derived : Base() {
fun baz(x: Int): Int = x + 1
fun foo() {
val x: Int? = null
super.<!INAPPLICABLE_CANDIDATE!>bar<!>(x)
this.<!INAPPLICABLE_CANDIDATE!>baz<!>(x)
if (x == null) return
super.bar(x)
this.baz(x)
val y: Int? = null
if (y != null) super.bar(this.baz(y))
else this.baz(super.<!INAPPLICABLE_CANDIDATE!>bar<!>(y))
}
}