[FIR] Don't create backing field for property without explicit type
#KT-41977 Fixed
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
// ISSUE: KT-41977
|
||||
|
||||
class A {
|
||||
val field: String = "" // (1)
|
||||
|
||||
val x
|
||||
get() = field.length // should be ok, resolve to (1)
|
||||
}
|
||||
|
||||
class B {
|
||||
val field: String = ""
|
||||
|
||||
val x: Int
|
||||
get() = field.<!UNRESOLVED_REFERENCE!>length<!> // should be an error
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
FILE: noBackingFieldInProperty.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val field: R|kotlin/String| = String()
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public final val x: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int| {
|
||||
^ this@R|/A|.R|/A.field|.R|kotlin/String.length|
|
||||
}
|
||||
|
||||
}
|
||||
public final class B : R|kotlin/Any| {
|
||||
public constructor(): R|B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val field: R|kotlin/String| = String()
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public final val x: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int| {
|
||||
^ this@R|/B|.F|/B.x|.<Unresolved name: length>#
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user