diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 97638c0dad5..46c621f84f1 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -13416,12 +13416,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnotherMutable.kt"); } - @Test - @TestMetadata("delegateToAnotherReflection.kt") - public void testDelegateToAnotherReflection() throws Exception { - runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnotherReflection.kt"); - } - @Test @TestMetadata("delegateToAnotherWithSideEffects.kt") public void testDelegateToAnotherWithSideEffects() throws Exception { @@ -13620,6 +13614,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/delegatedProperty/protectedVarWithPrivateSet.kt"); } + @Test + @TestMetadata("referenceEnclosingClassFieldInReceiver.kt") + public void testReferenceEnclosingClassFieldInReceiver() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver.kt"); + } + + @Test + @TestMetadata("referenceEnclosingClassFieldInReceiver2.kt") + public void testReferenceEnclosingClassFieldInReceiver2() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver2.kt"); + } + @Test @TestMetadata("setAsExtensionFun.kt") public void testSetAsExtensionFun() throws Exception { @@ -37865,6 +37871,28 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT public void testTopLevelProperty() throws Exception { runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt"); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/method") + @TestDataPath("$PROJECT_ROOT") + public class Method { + @Test + public void testAllFilesPresentInMethod() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/getDelegate/method"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("delegateMethodIsNonOverridable.kt") + public void testDelegateMethodIsNonOverridable() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateMethodIsNonOverridable.kt"); + } + + @Test + @TestMetadata("delegateToAnother.kt") + public void testDelegateToAnother() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToAnother.kt"); + } + } } @Nested diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt index 16dc1452fbe..456983a3e8a 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/LocalDeclarationsLowering.kt @@ -185,7 +185,8 @@ class LocalDeclarationsLowering( override fun irGet(startOffset: Int, endOffset: Int, valueDeclaration: IrValueDeclaration): IrExpression? { val field = classContext.capturedValueToField[valueDeclaration] ?: return null - val receiver = member.dispatchReceiverParameter!! + val receiver = member.dispatchReceiverParameter + ?: error("No dispatch receiver parameter for ${member.render()}") return IrGetFieldImpl( startOffset, endOffset, field.symbol, field.type, receiver = IrGetValueImpl(startOffset, endOffset, receiver.type, receiver.symbol) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLower.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLower.kt index bea47560a42..51903271436 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLower.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmLower.kt @@ -416,6 +416,7 @@ private val jvmFilePhases = listOf( typeOperatorLowering, replaceKFunctionInvokeWithFunctionInvokePhase, kotlinNothingValueExceptionPhase, + makePropertyDelegateMethodsStaticPhase, renameFieldsPhase, fakeInliningLocalVariablesLowering, diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt index baa41b53558..4b75dfbb400 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/JvmPropertiesLowering.kt @@ -27,7 +27,9 @@ import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrFieldAccessExpression import org.jetbrains.kotlin.ir.expressions.impl.IrBlockBodyImpl -import org.jetbrains.kotlin.ir.types.* +import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.types.classifierOrNull +import org.jetbrains.kotlin.ir.types.makeNotNull import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.load.java.JvmAbi @@ -185,14 +187,15 @@ class JvmPropertiesLowering(private val backendContext: JvmBackendContext) : IrE this.origin = origin this.returnType = returnType }.apply { - var index = 0 - valueParameters = listOfNotNull( - declaration.getter?.dispatchReceiverParameter?.takeIf { !isStatic }?.let { + if (!isStatic) { + dispatchReceiverParameter = declaration.getter?.dispatchReceiverParameter?.let { // Synthetic methods don't get generic type signatures anyway, so not exactly useful to preserve type parameters. - it.copyTo(this, type = it.type.eraseTypeParameters(), index = index++) - }, + it.copyTo(this, type = it.type.eraseTypeParameters()) + } + } + valueParameters = listOfNotNull( declaration.getter?.extensionReceiverParameter?.let { - it.copyTo(this, type = it.type.eraseTypeParameters(), index = index) + it.copyTo(this, type = it.type.eraseTypeParameters(), index = 0) } ) parent = declaration.parent diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/MakePropertyDelegateMethodsStaticLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/MakePropertyDelegateMethodsStaticLowering.kt new file mode 100644 index 00000000000..2ea4975735e --- /dev/null +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/MakePropertyDelegateMethodsStaticLowering.kt @@ -0,0 +1,73 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.backend.jvm.lower + +import org.jetbrains.kotlin.backend.common.FileLoweringPass +import org.jetbrains.kotlin.backend.common.ir.copyTo +import org.jetbrains.kotlin.backend.common.lower.VariableRemapper +import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase +import org.jetbrains.kotlin.backend.jvm.JvmBackendContext +import org.jetbrains.kotlin.backend.jvm.localDeclarationsPhase +import org.jetbrains.kotlin.ir.IrStatement +import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin +import org.jetbrains.kotlin.ir.declarations.IrFile +import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction +import org.jetbrains.kotlin.ir.expressions.IrCall +import org.jetbrains.kotlin.ir.expressions.IrExpression +import org.jetbrains.kotlin.ir.util.render +import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid +import org.jetbrains.kotlin.load.java.JvmAbi + +// This phase is needed to support correct generation of synthetic `$delegate` methods for optimized delegated properties, in the case +// when receiver of the optimized property reference is a field from an outer class. +// +// Since PropertyReferenceDelegationLowering runs before LocalDeclarationsLowering, fields for captured this (aka `this$0`) are not +// generated yet. And there's no other way to obtain the instance of the outer class on an arbitrary value of an inner class. +// However, we need `$delegate` methods to be static to be non-overridable (and public to be visible in reflection and external tools). +// +// So PropertyReferenceDelegationLowering generates `$delegate` methods for optimized property references as instance methods, +// and this phase, which runs _after_ LocalDeclarationsLowering, transforms them to static methods. +internal val makePropertyDelegateMethodsStaticPhase = makeIrFilePhase( + ::MakePropertyDelegateMethodsStaticLowering, + name = "MakePropertyDelegateMethodsStatic", + description = "Make `\$delegate` methods for optimized delegated properties static", + prerequisite = setOf(propertyReferenceDelegationPhase, localDeclarationsPhase) +) + +private class MakePropertyDelegateMethodsStaticLowering(val context: JvmBackendContext) : IrElementTransformerVoid(), FileLoweringPass { + override fun lower(irFile: IrFile) { + irFile.transform(this, null) + } + + override fun visitSimpleFunction(declaration: IrSimpleFunction): IrStatement { + if (!declaration.isSyntheticDelegateMethod()) return super.visitSimpleFunction(declaration) + + val oldParameter = declaration.dispatchReceiverParameter ?: return super.visitSimpleFunction(declaration) + val newParameter = oldParameter.copyTo(declaration, index = 0) + + return declaration.apply { + valueParameters = + listOf(newParameter) + valueParameters.map { it.copyTo(this, index = it.index + 1) } + dispatchReceiverParameter = null + body = body?.transform(VariableRemapper(mapOf(oldParameter to newParameter)), null) + } + } + + override fun visitCall(expression: IrCall): IrExpression { + // There should be no calls to synthetic `$delegate` methods because they aren't accessible in the source code, and we don't + // generate any calls in the IR. Otherwise we would need to remap arguments in those calls. + if (expression.symbol.owner.isSyntheticDelegateMethod()) { + error( + "`\$delegate` method should not be called. Please either remove the call, or support remapping of dispatch receiver " + + "in MakePropertyDelegateMethodsStaticLowering: ${expression.symbol.owner.render()}" + ) + } + return super.visitCall(expression) + } + + private fun IrSimpleFunction.isSyntheticDelegateMethod(): Boolean = + origin == IrDeclarationOrigin.PROPERTY_DELEGATE && name.asString().endsWith(JvmAbi.DELEGATED_PROPERTY_NAME_SUFFIX) +} diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/PropertyReferenceDelegationLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/PropertyReferenceDelegationLowering.kt index 05b5295a02a..7b5831af082 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/PropertyReferenceDelegationLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/PropertyReferenceDelegationLowering.kt @@ -151,11 +151,11 @@ private class PropertyReferenceDelegationTransformer(val context: JvmBackendCont getter?.apply { body = accessorBody(delegate, backingField ?: receiver?.inline(originalThis, dispatchReceiverParameter)) } setter?.apply { body = accessorBody(delegate, backingField ?: receiver?.inline(originalThis, dispatchReceiverParameter)) } + // The `$delegate` method is generated as instance method here, see MakePropertyDelegateMethodsStaticLowering. val delegateMethod = context.createSyntheticMethodForPropertyDelegate(this).apply { body = context.createJvmIrBuilder(symbol).run { - val propertyOwner = if (getter?.dispatchReceiverParameter != null) valueParameters[0] else null - val boundReceiver = backingField?.let { irGetField(propertyOwner?.let(::irGet), it) } - ?: receiver?.inline(originalThis, propertyOwner) + val boundReceiver = backingField?.let { irGetField(dispatchReceiverParameter?.let(::irGet), it) } + ?: receiver?.inline(originalThis, dispatchReceiverParameter) irExprBody(with(delegate) { val origin = PropertyReferenceLowering.REFLECTED_PROPERTY_REFERENCE IrPropertyReferenceImpl(startOffset, endOffset, type, symbol, typeArgumentsCount, field, getter, setter, origin) diff --git a/compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver.kt b/compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver.kt new file mode 100644 index 00000000000..a8575c8c3dd --- /dev/null +++ b/compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver.kt @@ -0,0 +1,23 @@ +// WITH_RUNTIME + +interface I { + var z: String +} + +class X { + var p: String = "Fail" +} + +class A { + val x = X() + + val y = object : I { + override var z: String by x::p + } +} + +fun box(): String { + val a = A() + a.y.z = "OK" + return a.y.z +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver2.kt b/compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver2.kt new file mode 100644 index 00000000000..c5d6b379050 --- /dev/null +++ b/compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver2.kt @@ -0,0 +1,25 @@ +// WITH_RUNTIME + +interface I { + var z: String +} + +class X { + var p: String = "Fail" +} + +class A { + val x = X() + + inner class Y : I { + override var z: String by x::p + } + + val y = Y() +} + +fun box(): String { + val a = A() + a.y.z = "OK" + return a.y.z +} diff --git a/compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateMethodIsNonOverridable.kt b/compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateMethodIsNonOverridable.kt new file mode 100644 index 00000000000..3f5086a1a91 --- /dev/null +++ b/compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateMethodIsNonOverridable.kt @@ -0,0 +1,34 @@ +// TARGET_BACKEND: JVM +// WITH_REFLECT + +import kotlin.reflect.* +import kotlin.reflect.jvm.isAccessible + +val a = 1 +val b = 2 + +fun KProperty0<*>.test(): String = + (apply { isAccessible = true }.getDelegate() as KProperty<*>).name + +open class C { + open val x by run { ::a } + open val y by ::a + + val xc = ::x.test() + val yc = ::y.test() +} + +class D : C() { + override val x by run { ::b } + override val y by ::b + + val xd = ::x.test() + val yd = ::y.test() +} + +fun box(): String { + val result = D().run { "$xc $yc $xd $yd" } + if (result != "a a b b") return "Fail: $result" + + return "OK" +} diff --git a/compiler/testData/codegen/box/delegatedProperty/delegateToAnotherReflection.kt b/compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToAnother.kt similarity index 71% rename from compiler/testData/codegen/box/delegatedProperty/delegateToAnotherReflection.kt rename to compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToAnother.kt index 46977f37e2f..0aeb0899f0a 100644 --- a/compiler/testData/codegen/box/delegatedProperty/delegateToAnotherReflection.kt +++ b/compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToAnother.kt @@ -11,6 +11,8 @@ class C(var x: Int) { class D(val c: C) { var y by c::x + var C.w by C::x + var Int.q by Int::x } var x = 1 @@ -40,6 +42,9 @@ fun KMutableProperty1.test(receiver: T) = fun KMutableProperty1.test(receiver: T, receiver2: T) = test({ getDelegate(receiver) as KMutableProperty1 }, { get(receiver2) }, { set(receiver2, it) }) +fun KMutableProperty2.test(receiver1: R1, receiver2: R2) = + test({ getDelegate(receiver1, receiver2) as KMutableProperty1 }, { get(receiver2) }, { set(receiver2, it) }) + fun box(): String { C::y.test(C(100), C(1)) C::z.test(C(1)) @@ -47,5 +52,12 @@ fun box(): String { ::y.test() ::z.test() Int::y.test({ getExtensionDelegate() as KMutableProperty1 }, { get(100) }, { set(100, it) }) + + val w = D::class.members.single { it.name == "w" } as KMutableProperty2 + w.test(D(C(100)), C(1)) + + val q = D::class.members.single { it.name == "q" } as KMutableProperty2 + q.test({ getExtensionDelegate(D(C(100))) as KMutableProperty1 }, { get(100) }, { set(100, it) }) + return "OK" } diff --git a/compiler/testData/codegen/bytecodeListing/delegatedProperty/delegateMethodIsNonOverridable.kt b/compiler/testData/codegen/bytecodeListing/delegatedProperty/delegateMethodIsNonOverridable.kt new file mode 100644 index 00000000000..4134cf51163 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/delegatedProperty/delegateMethodIsNonOverridable.kt @@ -0,0 +1,14 @@ +// WITH_RUNTIME + +val a = 1 +val b = 2 + +open class C { + open val x by run { ::a } + open val y by ::a +} + +class D : C() { + override val x by run { ::b } + override val y by ::b +} diff --git a/compiler/testData/codegen/bytecodeListing/delegatedProperty/delegateMethodIsNonOverridable.txt b/compiler/testData/codegen/bytecodeListing/delegatedProperty/delegateMethodIsNonOverridable.txt new file mode 100644 index 00000000000..08ebe119ea4 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/delegatedProperty/delegateMethodIsNonOverridable.txt @@ -0,0 +1,65 @@ +@kotlin.Metadata +synthetic final class C$x$2$1 { + // source: 'delegateMethodIsNonOverridable.kt' + public final static field INSTANCE: kotlin.reflect.KProperty0 + static method (): void + method (): void + public @org.jetbrains.annotations.Nullable method get(): java.lang.Object +} + +@kotlin.Metadata +synthetic final class C$y$2 { + // source: 'delegateMethodIsNonOverridable.kt' + public final static field INSTANCE: kotlin.reflect.KProperty0 + static method (): void + method (): void + public @org.jetbrains.annotations.Nullable method get(): java.lang.Object +} + +@kotlin.Metadata +public class C { + // source: 'delegateMethodIsNonOverridable.kt' + private final @org.jetbrains.annotations.NotNull field x$delegate: kotlin.reflect.KProperty0 + private final @org.jetbrains.annotations.NotNull field y$delegate: kotlin.reflect.KProperty0 + public method (): void + public method getX(): int + public method getY(): int +} + +@kotlin.Metadata +synthetic final class D$x$2$1 { + // source: 'delegateMethodIsNonOverridable.kt' + public final static field INSTANCE: kotlin.reflect.KProperty0 + static method (): void + method (): void + public @org.jetbrains.annotations.Nullable method get(): java.lang.Object +} + +@kotlin.Metadata +synthetic final class D$y$2 { + // source: 'delegateMethodIsNonOverridable.kt' + public final static field INSTANCE: kotlin.reflect.KProperty0 + static method (): void + method (): void + public @org.jetbrains.annotations.Nullable method get(): java.lang.Object +} + +@kotlin.Metadata +public final class D { + // source: 'delegateMethodIsNonOverridable.kt' + private final @org.jetbrains.annotations.NotNull field x$delegate: kotlin.reflect.KProperty0 + private final @org.jetbrains.annotations.NotNull field y$delegate: kotlin.reflect.KProperty0 + public method (): void + public method getX(): int + public method getY(): int +} + +@kotlin.Metadata +public final class DelegateMethodIsNonOverridableKt { + // source: 'delegateMethodIsNonOverridable.kt' + private final static field a: int + private final static field b: int + static method (): void + public final static method getA(): int + public final static method getB(): int +} diff --git a/compiler/testData/codegen/bytecodeListing/delegatedProperty/delegateMethodIsNonOverridable_ir.txt b/compiler/testData/codegen/bytecodeListing/delegatedProperty/delegateMethodIsNonOverridable_ir.txt new file mode 100644 index 00000000000..73b1786be67 --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/delegatedProperty/delegateMethodIsNonOverridable_ir.txt @@ -0,0 +1,53 @@ +@kotlin.Metadata +synthetic final class C$x$2$1 { + // source: 'delegateMethodIsNonOverridable.kt' + enclosing method C.()V + public final static field INSTANCE: C$x$2$1 + inner (anonymous) class C$x$2$1 + static method (): void + method (): void + public @org.jetbrains.annotations.Nullable method get(): java.lang.Object +} + +@kotlin.Metadata +public class C { + // source: 'delegateMethodIsNonOverridable.kt' + private final @org.jetbrains.annotations.NotNull field x$delegate: kotlin.reflect.KProperty0 + inner (anonymous) class C$x$2$1 + public method (): void + public method getX(): int + public static method getY$delegate(p0: C): java.lang.Object + public method getY(): int +} + +@kotlin.Metadata +synthetic final class D$x$2$1 { + // source: 'delegateMethodIsNonOverridable.kt' + enclosing method D.()V + public final static field INSTANCE: D$x$2$1 + inner (anonymous) class D$x$2$1 + static method (): void + method (): void + public @org.jetbrains.annotations.Nullable method get(): java.lang.Object +} + +@kotlin.Metadata +public final class D { + // source: 'delegateMethodIsNonOverridable.kt' + private final @org.jetbrains.annotations.NotNull field x$delegate: kotlin.reflect.KProperty0 + inner (anonymous) class D$x$2$1 + public method (): void + public method getX(): int + public static method getY$delegate(p0: D): java.lang.Object + public method getY(): int +} + +@kotlin.Metadata +public final class DelegateMethodIsNonOverridableKt { + // source: 'delegateMethodIsNonOverridable.kt' + private final static field a: int + private final static field b: int + static method (): void + public final static method getA(): int + public final static method getB(): int +} diff --git a/compiler/testData/codegen/bytecodeListing/delegatedPropertiesInCompanionObject.kt b/compiler/testData/codegen/bytecodeListing/delegatedProperty/delegatedPropertiesInCompanionObject.kt similarity index 100% rename from compiler/testData/codegen/bytecodeListing/delegatedPropertiesInCompanionObject.kt rename to compiler/testData/codegen/bytecodeListing/delegatedProperty/delegatedPropertiesInCompanionObject.kt diff --git a/compiler/testData/codegen/bytecodeListing/delegatedPropertiesInCompanionObject.txt b/compiler/testData/codegen/bytecodeListing/delegatedProperty/delegatedPropertiesInCompanionObject.txt similarity index 100% rename from compiler/testData/codegen/bytecodeListing/delegatedPropertiesInCompanionObject.txt rename to compiler/testData/codegen/bytecodeListing/delegatedProperty/delegatedPropertiesInCompanionObject.txt diff --git a/compiler/testData/codegen/bytecodeListing/delegatedPropertiesInCompanionObject_ir.txt b/compiler/testData/codegen/bytecodeListing/delegatedProperty/delegatedPropertiesInCompanionObject_ir.txt similarity index 100% rename from compiler/testData/codegen/bytecodeListing/delegatedPropertiesInCompanionObject_ir.txt rename to compiler/testData/codegen/bytecodeListing/delegatedProperty/delegatedPropertiesInCompanionObject_ir.txt diff --git a/compiler/testData/codegen/bytecodeText/optimizedDelegatedProperties/delegateToAnother.kt b/compiler/testData/codegen/bytecodeText/optimizedDelegatedProperties/delegateToAnother.kt index 11c104aeaed..2397dbafad0 100644 --- a/compiler/testData/codegen/bytecodeText/optimizedDelegatedProperties/delegateToAnother.kt +++ b/compiler/testData/codegen/bytecodeText/optimizedDelegatedProperties/delegateToAnother.kt @@ -35,11 +35,11 @@ fun local() { // 0 private final( static)? Lkotlin/reflect/KMutableProperty[0-2]; [xyz]m?\$delegate // 2 private final( static)? LC; [xyz]m?\$receiver // 0 LOCALVARIABLE [xyz]m? Lkotlin/reflect/KMutableProperty[0-2]; -// 12 static get[XYZ]m?\$delegate +// 12 public( static)? get[XYZ]m?\$delegate // JVM_TEMPLATES // Not optimized, references created as classes and stored in fields: // 16 extends kotlin/jvm/internal/MutablePropertyReference[0-2]Impl // 12 private final( static)? Lkotlin/reflect/KMutableProperty[0-2]; [xyz]m?\$delegate // 4 LOCALVARIABLE [xyz]m? Lkotlin/reflect/KMutableProperty[0-2]; -// 0 static get[XYZ]m?\$delegate +// 0 get[XYZ]m?\$delegate diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 35bf33961cc..433991c9ec9 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -13308,12 +13308,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnotherMutable.kt"); } - @Test - @TestMetadata("delegateToAnotherReflection.kt") - public void testDelegateToAnotherReflection() throws Exception { - runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnotherReflection.kt"); - } - @Test @TestMetadata("delegateToAnotherWithSideEffects.kt") public void testDelegateToAnotherWithSideEffects() throws Exception { @@ -13512,6 +13506,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/delegatedProperty/protectedVarWithPrivateSet.kt"); } + @Test + @TestMetadata("referenceEnclosingClassFieldInReceiver.kt") + public void testReferenceEnclosingClassFieldInReceiver() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver.kt"); + } + + @Test + @TestMetadata("referenceEnclosingClassFieldInReceiver2.kt") + public void testReferenceEnclosingClassFieldInReceiver2() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver2.kt"); + } + @Test @TestMetadata("setAsExtensionFun.kt") public void testSetAsExtensionFun() throws Exception { @@ -37685,6 +37691,28 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { public void testTopLevelProperty() throws Exception { runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt"); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/method") + @TestDataPath("$PROJECT_ROOT") + public class Method { + @Test + public void testAllFilesPresentInMethod() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/getDelegate/method"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("delegateMethodIsNonOverridable.kt") + public void testDelegateMethodIsNonOverridable() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateMethodIsNonOverridable.kt"); + } + + @Test + @TestMetadata("delegateToAnother.kt") + public void testDelegateToAnother() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToAnother.kt"); + } + } } @Nested diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeListingTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeListingTestGenerated.java index 262dc7a4565..5f63b5b0821 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BytecodeListingTestGenerated.java @@ -91,12 +91,6 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/defaultImpls.kt"); } - @Test - @TestMetadata("delegatedPropertiesInCompanionObject.kt") - public void testDelegatedPropertiesInCompanionObject() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/delegatedPropertiesInCompanionObject.kt"); - } - @Test @TestMetadata("delegationToJavaInterfaceWithWildcardType.kt") public void testDelegationToJavaInterfaceWithWildcardType() throws Exception { @@ -1009,6 +1003,28 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/bytecodeListing/delegatedProperty") + @TestDataPath("$PROJECT_ROOT") + public class DelegatedProperty { + @Test + public void testAllFilesPresentInDelegatedProperty() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/delegatedProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("delegateMethodIsNonOverridable.kt") + public void testDelegateMethodIsNonOverridable() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/delegatedProperty/delegateMethodIsNonOverridable.kt"); + } + + @Test + @TestMetadata("delegatedPropertiesInCompanionObject.kt") + public void testDelegatedPropertiesInCompanionObject() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/delegatedProperty/delegatedPropertiesInCompanionObject.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/bytecodeListing/deprecated") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index ee91a35d73f..37c80f1bf28 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -13416,12 +13416,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnotherMutable.kt"); } - @Test - @TestMetadata("delegateToAnotherReflection.kt") - public void testDelegateToAnotherReflection() throws Exception { - runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnotherReflection.kt"); - } - @Test @TestMetadata("delegateToAnotherWithSideEffects.kt") public void testDelegateToAnotherWithSideEffects() throws Exception { @@ -13620,6 +13614,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/delegatedProperty/protectedVarWithPrivateSet.kt"); } + @Test + @TestMetadata("referenceEnclosingClassFieldInReceiver.kt") + public void testReferenceEnclosingClassFieldInReceiver() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver.kt"); + } + + @Test + @TestMetadata("referenceEnclosingClassFieldInReceiver2.kt") + public void testReferenceEnclosingClassFieldInReceiver2() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver2.kt"); + } + @Test @TestMetadata("setAsExtensionFun.kt") public void testSetAsExtensionFun() throws Exception { @@ -37865,6 +37871,28 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes public void testTopLevelProperty() throws Exception { runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt"); } + + @Nested + @TestMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/method") + @TestDataPath("$PROJECT_ROOT") + public class Method { + @Test + public void testAllFilesPresentInMethod() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/getDelegate/method"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("delegateMethodIsNonOverridable.kt") + public void testDelegateMethodIsNonOverridable() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateMethodIsNonOverridable.kt"); + } + + @Test + @TestMetadata("delegateToAnother.kt") + public void testDelegateToAnother() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToAnother.kt"); + } + } } @Nested diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeListingTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeListingTestGenerated.java index 605545910be..3db6686cfaa 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeListingTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBytecodeListingTestGenerated.java @@ -91,12 +91,6 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes runTest("compiler/testData/codegen/bytecodeListing/defaultImpls.kt"); } - @Test - @TestMetadata("delegatedPropertiesInCompanionObject.kt") - public void testDelegatedPropertiesInCompanionObject() throws Exception { - runTest("compiler/testData/codegen/bytecodeListing/delegatedPropertiesInCompanionObject.kt"); - } - @Test @TestMetadata("delegationToJavaInterfaceWithWildcardType.kt") public void testDelegationToJavaInterfaceWithWildcardType() throws Exception { @@ -1057,6 +1051,28 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes } } + @Nested + @TestMetadata("compiler/testData/codegen/bytecodeListing/delegatedProperty") + @TestDataPath("$PROJECT_ROOT") + public class DelegatedProperty { + @Test + public void testAllFilesPresentInDelegatedProperty() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeListing/delegatedProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("delegateMethodIsNonOverridable.kt") + public void testDelegateMethodIsNonOverridable() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/delegatedProperty/delegateMethodIsNonOverridable.kt"); + } + + @Test + @TestMetadata("delegatedPropertiesInCompanionObject.kt") + public void testDelegatedPropertiesInCompanionObject() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/delegatedProperty/delegatedPropertiesInCompanionObject.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/bytecodeListing/deprecated") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index dbbd90e5921..c9a68c1dd0a 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -10823,11 +10823,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnotherMutable.kt"); } - @TestMetadata("delegateToAnotherReflection.kt") - public void testDelegateToAnotherReflection() throws Exception { - runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnotherReflection.kt"); - } - @TestMetadata("delegateToAnotherWithSideEffects.kt") public void testDelegateToAnotherWithSideEffects() throws Exception { runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnotherWithSideEffects.kt"); @@ -10983,6 +10978,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/delegatedProperty/protectedVarWithPrivateSet.kt"); } + @TestMetadata("referenceEnclosingClassFieldInReceiver.kt") + public void testReferenceEnclosingClassFieldInReceiver() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver.kt"); + } + + @TestMetadata("referenceEnclosingClassFieldInReceiver2.kt") + public void testReferenceEnclosingClassFieldInReceiver2() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver2.kt"); + } + @TestMetadata("setAsExtensionFun.kt") public void testSetAsExtensionFun() throws Exception { runTest("compiler/testData/codegen/box/delegatedProperty/setAsExtensionFun.kt"); @@ -30016,6 +30021,29 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes public void testTopLevelProperty() throws Exception { runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/topLevelProperty.kt"); } + + @TestMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/method") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Method extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInMethod() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/getDelegate/method"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("delegateMethodIsNonOverridable.kt") + public void testDelegateMethodIsNonOverridable() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateMethodIsNonOverridable.kt"); + } + + @TestMetadata("delegateToAnother.kt") + public void testDelegateToAnother() throws Exception { + runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToAnother.kt"); + } + } } @TestMetadata("compiler/testData/codegen/box/reflection/properties/jvmField") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index b98a176dbd7..4f1a22a34a2 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -9762,6 +9762,16 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/delegatedProperty/protectedVarWithPrivateSet.kt"); } + @TestMetadata("referenceEnclosingClassFieldInReceiver.kt") + public void testReferenceEnclosingClassFieldInReceiver() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver.kt"); + } + + @TestMetadata("referenceEnclosingClassFieldInReceiver2.kt") + public void testReferenceEnclosingClassFieldInReceiver2() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver2.kt"); + } + @TestMetadata("setAsExtensionFun.kt") public void testSetAsExtensionFun() throws Exception { runTest("compiler/testData/codegen/box/delegatedProperty/setAsExtensionFun.kt"); @@ -25681,6 +25691,19 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes public void testAllFilesPresentInGetDelegate() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/getDelegate"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + + @TestMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/method") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Method extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInMethod() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/getDelegate/method"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } } @TestMetadata("compiler/testData/codegen/box/reflection/properties/jvmField") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index dc5fb1ddf8c..0e11aa39c1a 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -9168,6 +9168,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/delegatedProperty/protectedVarWithPrivateSet.kt"); } + @TestMetadata("referenceEnclosingClassFieldInReceiver.kt") + public void testReferenceEnclosingClassFieldInReceiver() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver.kt"); + } + + @TestMetadata("referenceEnclosingClassFieldInReceiver2.kt") + public void testReferenceEnclosingClassFieldInReceiver2() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver2.kt"); + } + @TestMetadata("setAsExtensionFun.kt") public void testSetAsExtensionFun() throws Exception { runTest("compiler/testData/codegen/box/delegatedProperty/setAsExtensionFun.kt"); @@ -25087,6 +25097,19 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public void testAllFilesPresentInGetDelegate() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/getDelegate"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + + @TestMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/method") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Method extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInMethod() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/getDelegate/method"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } } @TestMetadata("compiler/testData/codegen/box/reflection/properties/jvmField") diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 106a698a543..b3e2b257143 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -9168,6 +9168,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/delegatedProperty/protectedVarWithPrivateSet.kt"); } + @TestMetadata("referenceEnclosingClassFieldInReceiver.kt") + public void testReferenceEnclosingClassFieldInReceiver() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver.kt"); + } + + @TestMetadata("referenceEnclosingClassFieldInReceiver2.kt") + public void testReferenceEnclosingClassFieldInReceiver2() throws Exception { + runTest("compiler/testData/codegen/box/delegatedProperty/referenceEnclosingClassFieldInReceiver2.kt"); + } + @TestMetadata("setAsExtensionFun.kt") public void testSetAsExtensionFun() throws Exception { runTest("compiler/testData/codegen/box/delegatedProperty/setAsExtensionFun.kt"); @@ -25047,6 +25057,19 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public void testAllFilesPresentInGetDelegate() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/getDelegate"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } + + @TestMetadata("compiler/testData/codegen/box/reflection/properties/getDelegate/method") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Method extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInMethod() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/reflection/properties/getDelegate/method"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + } } @TestMetadata("compiler/testData/codegen/box/reflection/properties/jvmField")