[FIR] Do not smartcast class delegation implemented properties
When a property is implemented via class delegation, it should be considered unstable for smart-casting. This is because it is unknown what kind of stability the underlying class delegate property has. It could be a stable property, or it could be implemented via a custom getter and unstable. ^KT-57417 Fixed
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
// ISSUE: KT-57417
|
||||
|
||||
interface HasProperty {
|
||||
val property: Int?
|
||||
}
|
||||
|
||||
class Test(delegate: HasProperty) : HasProperty by delegate
|
||||
|
||||
fun test(a: Test) {
|
||||
if (a.property != null) <!SMARTCAST_IMPOSSIBLE!>a.property<!> + 1
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// ISSUE: KT-57417
|
||||
|
||||
interface HasProperty {
|
||||
val property: Int?
|
||||
}
|
||||
|
||||
class Test(delegate: HasProperty) : HasProperty by delegate
|
||||
|
||||
fun test(a: Test) {
|
||||
if (a.property != null) <!DEBUG_INFO_SMARTCAST!>a.property<!> + 1
|
||||
}
|
||||
Reference in New Issue
Block a user