[FIR] Don't generate property fields when context receivers are present
^KT-59874
This commit is contained in:
committed by
Space Team
parent
4b67a504be
commit
d03039b949
+2
-1
@@ -834,7 +834,8 @@ class BodyResolveContext(
|
|||||||
val receiverTypeRef = property.receiverParameter?.typeRef
|
val receiverTypeRef = property.receiverParameter?.typeRef
|
||||||
addLocalScope(FirLocalScope(holder.session))
|
addLocalScope(FirLocalScope(holder.session))
|
||||||
if (!forContracts && receiverTypeRef == null && property.returnTypeRef !is FirImplicitTypeRef &&
|
if (!forContracts && receiverTypeRef == null && property.returnTypeRef !is FirImplicitTypeRef &&
|
||||||
!property.isLocal && property.delegate == null
|
!property.isLocal && property.delegate == null &&
|
||||||
|
property.contextReceivers.isEmpty()
|
||||||
) {
|
) {
|
||||||
storeBackingField(property, holder.session)
|
storeBackingField(property, holder.session)
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -4,7 +4,7 @@ class A<T>(val a: T)
|
|||||||
class B(val b: Any)
|
class B(val b: Any)
|
||||||
class C(val c: Any)
|
class C(val c: Any)
|
||||||
|
|
||||||
<!MUST_BE_INITIALIZED!>context(A<String>, B) var p: Int<!>
|
context(A<String>, B) var p: Int
|
||||||
get() {
|
get() {
|
||||||
this@A.a.length
|
this@A.a.length
|
||||||
this@B.b
|
this@B.b
|
||||||
@@ -15,10 +15,10 @@ class C(val c: Any)
|
|||||||
this@A.a.length
|
this@A.a.length
|
||||||
this@B.b
|
this@B.b
|
||||||
<!NO_THIS!>this<!>
|
<!NO_THIS!>this<!>
|
||||||
field = value
|
<!UNRESOLVED_REFERENCE!>field<!> = value
|
||||||
}
|
}
|
||||||
|
|
||||||
<!MUST_BE_INITIALIZED!>context(A<Int>, A<String>, B) var p: Int<!>
|
context(A<Int>, A<String>, B) var p: Int
|
||||||
get() {
|
get() {
|
||||||
this@A.a.<!UNRESOLVED_REFERENCE!>toDouble<!>()
|
this@A.a.<!UNRESOLVED_REFERENCE!>toDouble<!>()
|
||||||
this@A.a.length
|
this@A.a.length
|
||||||
@@ -30,7 +30,7 @@ class C(val c: Any)
|
|||||||
this@A.a.length
|
this@A.a.length
|
||||||
this@B.b
|
this@B.b
|
||||||
<!NO_THIS!>this<!>
|
<!NO_THIS!>this<!>
|
||||||
field = value
|
<!UNRESOLVED_REFERENCE!>field<!> = value
|
||||||
}
|
}
|
||||||
|
|
||||||
context(A<Int>, A<String>, B) val C.p: Int
|
context(A<Int>, A<String>, B) val C.p: Int
|
||||||
|
|||||||
Reference in New Issue
Block a user