[FIR] Transform context receivers on properties during type resolution stage

^KT-53706 Fixed
This commit is contained in:
Dmitriy Novozhilov
2022-08-24 17:06:50 +03:00
committed by teamcity
parent 7ef2f7ccde
commit 66117367ad
4 changed files with 30 additions and 0 deletions
@@ -17005,6 +17005,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/extensionClasses/generics.kt");
}
@Test
@TestMetadata("propertyWithContext.kt")
public void testPropertyWithContext() throws Exception {
runTest("compiler/testData/codegen/box/extensionClasses/propertyWithContext.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
@@ -120,6 +120,7 @@ open class FirTypeResolveTransformer(
property.transformTypeParameters(this, data)
.transformReturnTypeRef(this, data)
.transformReceiverTypeRef(this, data)
.transformContextReceivers(this, data)
.transformGetter(this, data)
.transformSetter(this, data)
.transformBackingField(this, data)
@@ -0,0 +1,17 @@
// LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// ISSUE: KT-53706
fun box(): String {
return with(SomeContext()) {
"error".foo
}
}
class SomeContext {
val value: String = "OK"
}
context(SomeContext)
val String.foo: String
get() = value
@@ -17005,6 +17005,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/extensionClasses/generics.kt");
}
@Test
@TestMetadata("propertyWithContext.kt")
public void testPropertyWithContext() throws Exception {
runTest("compiler/testData/codegen/box/extensionClasses/propertyWithContext.kt");
}
@Test
@TestMetadata("simple.kt")
public void testSimple() throws Exception {