[FIR] KT-37009: Fix loss of bound smart-cast due to synthetic removal

This commit is contained in:
simon.ogorodnik
2020-02-25 17:45:49 +03:00
parent ec936b7286
commit 7c4f59dfcb
11 changed files with 206 additions and 8 deletions
@@ -19,8 +19,8 @@ fun g(a: SomeClass?) {
val b = (a as? SomeSubClass)?.foo
if (b != null) {
// 'a' can be cast to SomeSubClass
a.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
a.<!UNRESOLVED_REFERENCE!>foo<!>
a.hashCode()
a.foo
(a as? SomeSubClass).<!INAPPLICABLE_CANDIDATE!>foo<!>
(a as SomeSubClass).foo
}
@@ -19,8 +19,8 @@ fun g(a: SomeClass?) {
val b = (a as? SomeSubClass)?.foo
if (b != null) {
// 'a' can be cast to SomeSubClass
a.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
a.<!UNRESOLVED_REFERENCE!>foo<!>
a.hashCode()
a.foo
(a as? SomeSubClass).<!INAPPLICABLE_CANDIDATE!>foo<!>
(a as SomeSubClass).foo
}
@@ -27,8 +27,8 @@ fun g(a: SomeClass?) {
c = Impl
if (c != null) {
// 'a' cannot be cast to SomeSubClass
a.hashCode()
a.foo
a.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
a.<!UNRESOLVED_REFERENCE!>foo<!>
(a as? SomeSubClass).<!INAPPLICABLE_CANDIDATE!>foo<!>
c.hashCode()
c.foo
@@ -63,7 +63,7 @@ fun kt4565_2(a: SomeClass?) {
}
val extra = (a as? SubClass)?.extra
if (extra != null) {
a.<!UNRESOLVED_REFERENCE!>extra<!>.<!UNRESOLVED_REFERENCE!>hashCode<!>()
a.extra.hashCode()
}
}