Files
Simon Ogorodnik 513af2dfbc FIR. Refactor smart-cast representation in FIR tree
Make smart-casts non-transparent expression without delegation
to underlying FirQualifiedAccessExpression, as children delegation in
fir tree has unclear semantics
Remove two different kinds of tree nodes for smart-casts
2022-08-15 21:46:11 +00:00

21 lines
408 B
Kotlin
Vendored

abstract class Foo {
abstract val bar: Bar?
}
abstract class Bar {
abstract val buz: Buz?
}
class Buz
fun takesNullable(b: Buz?) {}
fun takesNonNull(b: Buz) {}
fun foo(foo: Foo) {
if (foo.bar?.buz != null) {
// Here we have unstable smart-cast on foo.bar?.buz
takesNullable(foo.bar?.buz) // OK
takesNonNull(<!ARGUMENT_TYPE_MISMATCH!>foo.bar?.buz<!>) // NOT OK
}
}