[FIR] Don't generate property fields when context receivers are present

^KT-59874
This commit is contained in:
Nikolay Lunyak
2023-09-14 11:58:05 +03:00
committed by Space Team
parent 4b67a504be
commit d03039b949
2 changed files with 6 additions and 5 deletions
@@ -834,7 +834,8 @@ class BodyResolveContext(
val receiverTypeRef = property.receiverParameter?.typeRef
addLocalScope(FirLocalScope(holder.session))
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)
}
@@ -4,7 +4,7 @@ class A<T>(val a: T)
class B(val b: Any)
class C(val c: Any)
<!MUST_BE_INITIALIZED!>context(A<String>, B) var p: Int<!>
context(A<String>, B) var p: Int
get() {
this@A.a.length
this@B.b
@@ -15,10 +15,10 @@ class C(val c: Any)
this@A.a.length
this@B.b
<!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() {
this@A.a.<!UNRESOLVED_REFERENCE!>toDouble<!>()
this@A.a.length
@@ -30,7 +30,7 @@ class C(val c: Any)
this@A.a.length
this@B.b
<!NO_THIS!>this<!>
field = value
<!UNRESOLVED_REFERENCE!>field<!> = value
}
context(A<Int>, A<String>, B) val C.p: Int