KT-23397 Optimize out field for property delegate when it's safe (JVM)

This commit is contained in:
Pavel Mikhailovskii
2022-06-03 16:54:12 +02:00
committed by teamcity
parent 9ee0268197
commit 65b2cee913
83 changed files with 3015 additions and 19 deletions
@@ -14597,6 +14597,178 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToConst")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToConst {
@Test
public void testAllFilesPresentInDelegateToConst() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConst.kt");
}
@Test
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConstProperty.kt");
}
@Test
@TestMetadata("delegateToNull.kt")
public void testDelegateToNull() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToNull.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToFinalProperty {
@Test
public void testAllFilesPresentInDelegateToFinalProperty() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("chain.kt")
public void testChain() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/chain.kt");
}
@Test
@TestMetadata("delegateToFinalInstanceProperty.kt")
public void testDelegateToFinalInstanceProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalInstanceProperty.kt");
}
@Test
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalObjectProperty.kt");
}
@Test
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalProperty.kt");
}
@Test
@TestMetadata("finalPropertyInAnotherFile.kt")
public void testFinalPropertyInAnotherFile() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/finalPropertyInAnotherFile.kt");
}
@Test
@TestMetadata("initializeContainerOfTopLevelProperties.kt")
public void testInitializeContainerOfTopLevelProperties() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/initializeContainerOfTopLevelProperties.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndImportFromObject.kt")
public void testMemberExtensionPropertyAndImportFromObject() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndImportFromObject.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndLocalDelegatedProperty.kt")
public void testMemberExtensionPropertyAndLocalDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndLocalDelegatedProperty.kt");
}
@Test
@TestMetadata("multimodule.kt")
public void testMultimodule() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/multimodule.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToSingleton {
@Test
public void testAllFilesPresentInDelegateToSingleton() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnum.kt");
}
@Test
@TestMetadata("delegateToEnumInAClass.kt")
public void testDelegateToEnumInAClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnumInAClass.kt");
}
@Test
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToSingleton.kt");
}
@Test
@TestMetadata("noInitializationOfOuterClass.kt")
public void testNoInitializationOfOuterClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/noInitializationOfOuterClass.kt");
}
@Test
@TestMetadata("withSideEffects.kt")
public void testWithSideEffects() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffects.kt");
}
@Test
@TestMetadata("withSideEffectsFromFileClass.kt")
public void testWithSideEffectsFromFileClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsFromFileClass.kt");
}
@Test
@TestMetadata("withSideEffectsToEnum.kt")
public void testWithSideEffectsToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsToEnum.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToThis")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToThis {
@Test
public void testAllFilesPresentInDelegateToThis() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToThis"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("delegateToOuterThis.kt")
public void testDelegateToOuterThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToOuterThis.kt");
}
@Test
@TestMetadata("delegateToThis.kt")
public void testDelegateToThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThis.kt");
}
@Test
@TestMetadata("delegateToThisByExtension.kt")
public void testDelegateToThisByExtension() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThisByExtension.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/local")
@TestDataPath("$PROJECT_ROOT")
@@ -42815,6 +42987,42 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
public void testDelegateToAnother() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToAnother.kt");
}
@Test
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToConst.kt");
}
@Test
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToConstProperty.kt");
}
@Test
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToEnum.kt");
}
@Test
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToFinalObjectProperty.kt");
}
@Test
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToFinalProperty.kt");
}
@Test
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToSingleton.kt");
}
}
}
@@ -290,6 +290,7 @@ private val jvmFilePhases = listOf(
functionReferencePhase,
suspendLambdaPhase,
propertyReferenceDelegationPhase,
singletonOrConstantDelegationPhase,
propertyReferencePhase,
arrayConstructorPhase,
constPhase1,
@@ -105,19 +105,6 @@ private class PropertyReferenceDelegationTransformer(val context: JvmBackendCont
correspondingPropertySymbol?.let { it.owner.getter == this && it.owner.setter == null } == true &&
modality == Modality.FINAL
private fun IrExpression.inline(oldReceiver: IrValueParameter?, newReceiver: IrValueParameter?): IrExpression = when (this) {
is IrGetField ->
IrGetFieldImpl(startOffset, endOffset, symbol, type, receiver?.inline(oldReceiver, newReceiver), origin, superQualifierSymbol)
is IrGetValue ->
IrGetValueImpl(startOffset, endOffset, type, newReceiver?.symbol.takeIf { symbol == oldReceiver?.symbol } ?: symbol, origin)
is IrCall ->
IrCallImpl(startOffset, endOffset, type, symbol, typeArgumentsCount, valueArgumentsCount, origin, superQualifierSymbol).apply {
dispatchReceiver = this@inline.dispatchReceiver?.inline(oldReceiver, newReceiver)
extensionReceiver = this@inline.extensionReceiver?.inline(oldReceiver, newReceiver)
}
else -> shallowCopy()
}
override fun visitClass(declaration: IrClass): IrStatement {
declaration.transformChildren(this, null)
declaration.transformDeclarationsFlat {
@@ -150,14 +137,14 @@ private class PropertyReferenceDelegationTransformer(val context: JvmBackendCont
}
}
val originalThis = parentAsClass.thisReceiver
getter?.apply { body = accessorBody(delegate, backingField ?: receiver?.inline(originalThis, dispatchReceiverParameter)) }
setter?.apply { body = accessorBody(delegate, backingField ?: receiver?.inline(originalThis, dispatchReceiverParameter)) }
getter?.apply { body = accessorBody(delegate, backingField ?: receiver?.remapReceiver(originalThis, dispatchReceiverParameter)) }
setter?.apply { body = accessorBody(delegate, backingField ?: receiver?.remapReceiver(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 boundReceiver = backingField?.let { irGetField(dispatchReceiverParameter?.let(::irGet), it) }
?: receiver?.inline(originalThis, dispatchReceiverParameter)
?: receiver?.remapReceiver(originalThis, dispatchReceiverParameter)
irExprBody(with(delegate) {
val origin = PropertyReferenceLowering.REFLECTED_PROPERTY_REFERENCE
IrPropertyReferenceImpl(startOffset, endOffset, type, symbol, typeArgumentsCount, field, getter, setter, origin)
@@ -179,7 +166,7 @@ private class PropertyReferenceDelegationTransformer(val context: JvmBackendCont
symbol,
parentAsClass.isFacadeClass
).apply {
body = context.irFactory.createBlockBody(startOffset, endOffset, listOf(it.inline(null, null)))
body = context.irFactory.createBlockBody(startOffset, endOffset, listOf(it.remapReceiver(null, null)))
}
}
return listOfNotNull(this, delegateMethod, receiverBlock)
@@ -0,0 +1,104 @@
/*
* Copyright 2010-2022 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.phaser.makeIrFilePhase
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.backend.jvm.ir.createJvmIrBuilder
import org.jetbrains.kotlin.backend.jvm.lower.JvmPropertiesLowering.Companion.createSyntheticMethodForPropertyDelegate
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.ir.builders.irExprBody
import org.jetbrains.kotlin.ir.declarations.*
import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.symbols.impl.IrAnonymousInitializerSymbolImpl
import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.ir.visitors.IrElementTransformer
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.util.OperatorNameConventions
internal val singletonOrConstantDelegationPhase = makeIrFilePhase(
::SingletonOrConstantDelegationLowering,
name = "SingletonOrConstantDelegation",
description = "Optimize `val x by ConstOrSingleton`: there is no need to store the value in a field"
)
private class SingletonOrConstantDelegationLowering(val context: JvmBackendContext) : FileLoweringPass {
override fun lower(irFile: IrFile) {
if (!context.state.generateOptimizedCallableReferenceSuperClasses) return
irFile.transform(SingletonOrConstantDelegationTransformer(context), null)
}
}
private class SingletonOrConstantDelegationTransformer(val context: JvmBackendContext) : IrElementTransformerVoid() {
override fun visitClass(declaration: IrClass): IrClass {
declaration.transformChildren(this, null)
declaration.transformDeclarationsFlat {
(it as? IrProperty)?.transform()
}
return declaration
}
private fun IrProperty.transform(): List<IrDeclaration>? {
if (!isDelegated || isFakeOverride || backingField == null) return null
val delegate = backingField?.initializer?.expression?.takeIf { it.isInlineable() } ?: return null
val originalThis = parentAsClass.thisReceiver
val receiverMapper = object : IrElementTransformer<Pair<Name, IrExpression>> {
override fun visitCall(expression: IrCall, data: Pair<Name, IrExpression>): IrExpression {
val (name, newReceiver) = data
if (expression.symbol.owner.name == name) {
if ((expression.dispatchReceiver as? IrGetField)?.symbol == backingField?.symbol) {
expression.dispatchReceiver = newReceiver
} else if ((expression.extensionReceiver as? IrGetField)?.symbol == backingField?.symbol) {
expression.extensionReceiver = newReceiver
}
}
return expression
}
}
getter?.transform(receiverMapper,OperatorNameConventions.GET_VALUE to delegate.remapReceiver(originalThis, getter?.dispatchReceiverParameter))
setter?.transform(receiverMapper,OperatorNameConventions.SET_VALUE to delegate.remapReceiver(originalThis, setter?.dispatchReceiverParameter))
backingField = null
val initializerBlock = if (delegate !is IrConst<*> && delegate !is IrGetValue)
context.irFactory.createAnonymousInitializer(
delegate.startOffset,
delegate.endOffset,
IrDeclarationOrigin.DEFINED,
IrAnonymousInitializerSymbolImpl(parentAsClass.symbol),
parentAsClass.isFileClass
).apply {
body = context.irFactory.createBlockBody(delegate.startOffset, delegate.endOffset, listOf(delegate.remapReceiver(null, null)))
}
else null
val delegateMethod = context.createSyntheticMethodForPropertyDelegate(this).apply {
body = context.createJvmIrBuilder(symbol).run { irExprBody(delegate.remapReceiver(originalThis, dispatchReceiverParameter)) }
}
return listOfNotNull(this, initializerBlock, delegateMethod)
}
private fun IrExpression.isInlineable(): Boolean =
when (this) {
is IrConst<*>, is IrGetSingletonValue -> true
is IrCall ->
dispatchReceiver?.isInlineable() != false
&& extensionReceiver?.isInlineable() != false
&& valueArgumentsCount == 0
&& symbol.owner.run {
modality == Modality.FINAL
&& origin == IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR
&& ((body?.statements?.singleOrNull() as? IrReturn)?.value as? IrGetField)?.symbol?.owner?.isFinal == true
}
is IrGetValue ->
symbol.owner.origin == IrDeclarationOrigin.INSTANCE_RECEIVER
else -> false
}
}
@@ -600,6 +600,13 @@ fun IrExpression.shallowCopy(): IrExpression =
fun IrExpression.shallowCopyOrNull(): IrExpression? =
when (this) {
is IrConst<*> -> shallowCopy()
is IrGetEnumValue ->
IrGetEnumValueImpl(
startOffset,
endOffset,
type,
symbol
)
is IrGetObjectValue ->
IrGetObjectValueImpl(
startOffset,
@@ -633,6 +640,19 @@ internal fun <T> IrConst<T>.shallowCopy() = IrConstImpl(
value
)
fun IrExpression.remapReceiver(oldReceiver: IrValueParameter?, newReceiver: IrValueParameter?): IrExpression = when (this) {
is IrGetField ->
IrGetFieldImpl(startOffset, endOffset, symbol, type, receiver?.remapReceiver(oldReceiver, newReceiver), origin, superQualifierSymbol)
is IrGetValue ->
IrGetValueImpl(startOffset, endOffset, type, newReceiver?.symbol.takeIf { symbol == oldReceiver?.symbol } ?: symbol, origin)
is IrCall ->
IrCallImpl(startOffset, endOffset, type, symbol, typeArgumentsCount, valueArgumentsCount, origin, superQualifierSymbol).also {
it.dispatchReceiver = dispatchReceiver?.remapReceiver(oldReceiver, newReceiver)
it.extensionReceiver = extensionReceiver?.remapReceiver(oldReceiver, newReceiver)
}
else -> shallowCopy()
}
val IrDeclarationParent.isFacadeClass: Boolean
get() = this is IrClass &&
(origin == IrDeclarationOrigin.JVM_MULTIFILE_CLASS ||
@@ -0,0 +1,8 @@
// CHECK_BYTECODE_LISTING
operator fun Any?.getValue(thisRef: Any?, property: Any?) =
if (this == 1 && thisRef == null) "OK" else "Failed"
val s: String by 1
fun box() = s
@@ -0,0 +1,10 @@
@kotlin.Metadata
public final class DelegateToConstKt {
// source: 'delegateToConst.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final static field s$delegate: int
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,10 @@
// CHECK_BYTECODE_LISTING
operator fun Any?.getValue(thisRef: Any?, property: Any?) =
if (this == a && thisRef == null) "OK" else "Failed"
const val a = "TEXT"
val s: String by a
fun box(): String = s
@@ -0,0 +1,11 @@
@kotlin.Metadata
public final class DelegateToConstPropertyKt {
// source: 'delegateToConstProperty.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
public final static @org.jetbrains.annotations.NotNull field a: java.lang.String
private final static @org.jetbrains.annotations.NotNull field s$delegate: java.lang.String
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,11 @@
@kotlin.Metadata
public final class DelegateToConstPropertyKt {
// source: 'delegateToConstProperty.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
public final static @org.jetbrains.annotations.NotNull field a: java.lang.String
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
private static method getS$delegate(): java.lang.Object
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,10 @@
@kotlin.Metadata
public final class DelegateToConstKt {
// source: 'delegateToConst.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
private static method getS$delegate(): java.lang.Object
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,8 @@
// CHECK_BYTECODE_LISTING
operator fun Any?.getValue(thisRef: Any?, property: Any?) =
if (this == null && thisRef == null) "OK" else "Failed"
val s: String by null
fun box() = s
@@ -0,0 +1,10 @@
@kotlin.Metadata
public final class DelegateToNullKt {
// source: 'delegateToNull.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final static @org.jetbrains.annotations.NotNull field s$delegate: java.lang.Void
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,10 @@
@kotlin.Metadata
public final class DelegateToNullKt {
// source: 'delegateToNull.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
private static method getS$delegate(): java.lang.Object
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,26 @@
// CHECK_BYTECODE_LISTING
class A {
val b = B()
}
class B {
val c = C()
}
class C {
val d = D()
}
class D {
val e = 1
}
val a = A()
operator fun Int.getValue(thisRef: Any?, property: Any?) =
if (this == 1 && thisRef == null) "OK" else "Failed"
val x by a.b.c.d.e
fun box() = x
@@ -0,0 +1,44 @@
@kotlin.Metadata
public final class A {
// source: 'chain.kt'
private final @org.jetbrains.annotations.NotNull field b: B
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getB(): B
}
@kotlin.Metadata
public final class B {
// source: 'chain.kt'
private final @org.jetbrains.annotations.NotNull field c: C
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getC(): C
}
@kotlin.Metadata
public final class C {
// source: 'chain.kt'
private final @org.jetbrains.annotations.NotNull field d: D
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getD(): D
}
@kotlin.Metadata
public final class ChainKt {
// source: 'chain.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final static @org.jetbrains.annotations.NotNull field a: A
private final static field x$delegate: int
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getA(): A
public final static @org.jetbrains.annotations.NotNull method getValue(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getX(): java.lang.String
}
@kotlin.Metadata
public final class D {
// source: 'chain.kt'
private final field e: int
public method <init>(): void
public final method getE(): int
}
@@ -0,0 +1,44 @@
@kotlin.Metadata
public final class A {
// source: 'chain.kt'
private final @org.jetbrains.annotations.NotNull field b: B
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getB(): B
}
@kotlin.Metadata
public final class B {
// source: 'chain.kt'
private final @org.jetbrains.annotations.NotNull field c: C
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getC(): C
}
@kotlin.Metadata
public final class C {
// source: 'chain.kt'
private final @org.jetbrains.annotations.NotNull field d: D
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getD(): D
}
@kotlin.Metadata
public final class ChainKt {
// source: 'chain.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final static @org.jetbrains.annotations.NotNull field a: A
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getA(): A
public final static @org.jetbrains.annotations.NotNull method getValue(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
private static method getX$delegate(): java.lang.Object
public final static @org.jetbrains.annotations.NotNull method getX(): java.lang.String
}
@kotlin.Metadata
public final class D {
// source: 'chain.kt'
private final field e: int
public method <init>(): void
public final method getE(): int
}
@@ -0,0 +1,14 @@
// CHECK_BYTECODE_LISTING
class C {
val impl = 123
val s: String by impl
}
val c = C()
operator fun Any?.getValue(thisRef: Any?, property: Any?) =
if (this == 123 && thisRef == c) "OK" else "Failed"
fun box() = c.s
@@ -0,0 +1,21 @@
@kotlin.Metadata
public final class C {
// source: 'delegateToFinalInstanceProperty.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final field impl: int
private final field s$delegate: int
static method <clinit>(): void
public method <init>(): void
public final method getImpl(): int
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
}
@kotlin.Metadata
public final class DelegateToFinalInstancePropertyKt {
// source: 'delegateToFinalInstanceProperty.kt'
private final static @org.jetbrains.annotations.NotNull field c: C
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getC(): C
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,21 @@
@kotlin.Metadata
public final class C {
// source: 'delegateToFinalInstanceProperty.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final field impl: int
static method <clinit>(): void
public method <init>(): void
public final method getImpl(): int
private static method getS$delegate(p0: C): java.lang.Object
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
}
@kotlin.Metadata
public final class DelegateToFinalInstancePropertyKt {
// source: 'delegateToFinalInstanceProperty.kt'
private final static @org.jetbrains.annotations.NotNull field c: C
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getC(): C
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,12 @@
// CHECK_BYTECODE_LISTING
object O {
val impl = 123
}
operator fun Any?.getValue(thisRef: Any?, property: Any?) =
if (this == 123 && thisRef == null) "OK" else "Failed"
val s: String by O.impl
fun box() = s
@@ -0,0 +1,20 @@
@kotlin.Metadata
public final class DelegateToFinalObjectPropertyKt {
// source: 'delegateToFinalObjectProperty.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final static field s$delegate: int
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final class O {
// source: 'delegateToFinalObjectProperty.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
private final static field impl: int
static method <clinit>(): void
private method <init>(): void
public final method getImpl(): int
}
@@ -0,0 +1,20 @@
@kotlin.Metadata
public final class DelegateToFinalObjectPropertyKt {
// source: 'delegateToFinalObjectProperty.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
private static method getS$delegate(): java.lang.Object
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final class O {
// source: 'delegateToFinalObjectProperty.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
private final static field impl: int
static method <clinit>(): void
private method <init>(): void
public final method getImpl(): int
}
@@ -0,0 +1,10 @@
// CHECK_BYTECODE_LISTING
val impl = 123
operator fun Any?.getValue(thisRef: Any?, property: Any?) =
if (this == 123 && thisRef == null) "OK" else "Failed"
val s: String by impl
fun box() = s
@@ -0,0 +1,12 @@
@kotlin.Metadata
public final class DelegateToFinalPropertyKt {
// source: 'delegateToFinalProperty.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final static field impl: int
private final static field s$delegate: int
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method getImpl(): int
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,12 @@
@kotlin.Metadata
public final class DelegateToFinalPropertyKt {
// source: 'delegateToFinalProperty.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final static field impl: int
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method getImpl(): int
private static method getS$delegate(): java.lang.Object
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,12 @@
// CHECK_BYTECODE_LISTING
//FILE file1.kt
val impl = 123
//FILE file2.kt
operator fun Any?.getValue(thisRef: Any?, property: Any?) =
if (this == 123 && thisRef == null) "OK" else "Failed"
val s: String by impl
fun box() = s
@@ -0,0 +1,12 @@
@kotlin.Metadata
public final class FinalPropertyInAnotherFileKt {
// source: 'finalPropertyInAnotherFile.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final static field impl: int
private final static field s$delegate: int
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method getImpl(): int
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,12 @@
@kotlin.Metadata
public final class FinalPropertyInAnotherFileKt {
// source: 'finalPropertyInAnotherFile.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final static field impl: int
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method getImpl(): int
private static method getS$delegate(): java.lang.Object
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,18 @@
// FILE: 1.kt
var result = "Fail"
val unused by c
fun box(): String = result
// FILE: 2.kt
class C {
init {
result = "OK"
}
}
operator fun C.getValue(x: Any?, y: Any?): String = throw IllegalStateException()
val c = C()
@@ -0,0 +1,18 @@
// CHECK_BYTECODE_LISTING
import O.d
enum class E { X }
object O {
val E.d: Delegate get() = Delegate()
}
class Delegate {
operator fun getValue(thisRef: Any?, property: Any?) =
if (thisRef == null) "OK" else "Failed"
}
val result by E.X.d
fun box(): String = result
@@ -0,0 +1,36 @@
@kotlin.Metadata
public final class Delegate {
// source: 'memberExtensionPropertyAndImportFromObject.kt'
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final enum class E {
// source: 'memberExtensionPropertyAndImportFromObject.kt'
private synthetic final static field $VALUES: E[]
public final enum static field X: E
static method <clinit>(): void
private method <init>(p0: java.lang.String, p1: int): void
public static method valueOf(p0: java.lang.String): E
public static method values(): E[]
}
@kotlin.Metadata
public final class MemberExtensionPropertyAndImportFromObjectKt {
// source: 'memberExtensionPropertyAndImportFromObject.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final static @org.jetbrains.annotations.NotNull field result$delegate: Delegate
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getResult(): java.lang.String
}
@kotlin.Metadata
public final class O {
// source: 'memberExtensionPropertyAndImportFromObject.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
static method <clinit>(): void
private method <init>(): void
public final @org.jetbrains.annotations.NotNull method getD(@org.jetbrains.annotations.NotNull p0: E): Delegate
}
@@ -0,0 +1,37 @@
@kotlin.Metadata
public final class Delegate {
// source: 'memberExtensionPropertyAndImportFromObject.kt'
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final enum class E {
// source: 'memberExtensionPropertyAndImportFromObject.kt'
private synthetic final static field $VALUES: E[]
public final enum static field X: E
private synthetic final static method $values(): E[]
static method <clinit>(): void
private method <init>(p0: java.lang.String, p1: int): void
public static method valueOf(p0: java.lang.String): E
public static method values(): E[]
}
@kotlin.Metadata
public final class MemberExtensionPropertyAndImportFromObjectKt {
// source: 'memberExtensionPropertyAndImportFromObject.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final static @org.jetbrains.annotations.NotNull field result$delegate: Delegate
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getResult(): java.lang.String
}
@kotlin.Metadata
public final class O {
// source: 'memberExtensionPropertyAndImportFromObject.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
static method <clinit>(): void
private method <init>(): void
public final @org.jetbrains.annotations.NotNull method getD(@org.jetbrains.annotations.NotNull p0: E): Delegate
}
@@ -0,0 +1,17 @@
// CHECK_BYTECODE_LISTING
enum class E { X }
object O {
val E.d: Delegate get() = Delegate()
}
class Delegate {
operator fun getValue(thisRef: Any?, property: Any?) =
if (thisRef == null) "OK" else "Failed"
}
fun box(): String = with(O) {
val result by E.X.d
result
}
@@ -0,0 +1,34 @@
@kotlin.Metadata
public final class Delegate {
// source: 'memberExtensionPropertyAndLocalDelegatedProperty.kt'
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final enum class E {
// source: 'memberExtensionPropertyAndLocalDelegatedProperty.kt'
private synthetic final static field $VALUES: E[]
public final enum static field X: E
static method <clinit>(): void
private method <init>(p0: java.lang.String, p1: int): void
public static method valueOf(p0: java.lang.String): E
public static method values(): E[]
}
@kotlin.Metadata
public final class MemberExtensionPropertyAndLocalDelegatedPropertyKt {
// source: 'memberExtensionPropertyAndLocalDelegatedProperty.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@kotlin.Metadata
public final class O {
// source: 'memberExtensionPropertyAndLocalDelegatedProperty.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
static method <clinit>(): void
private method <init>(): void
public final @org.jetbrains.annotations.NotNull method getD(@org.jetbrains.annotations.NotNull p0: E): Delegate
}
@@ -0,0 +1,36 @@
@kotlin.Metadata
public final class Delegate {
// source: 'memberExtensionPropertyAndLocalDelegatedProperty.kt'
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final enum class E {
// source: 'memberExtensionPropertyAndLocalDelegatedProperty.kt'
private synthetic final static field $VALUES: E[]
public final enum static field X: E
private synthetic final static method $values(): E[]
static method <clinit>(): void
private method <init>(p0: java.lang.String, p1: int): void
public static method valueOf(p0: java.lang.String): E
public static method values(): E[]
}
@kotlin.Metadata
public final class MemberExtensionPropertyAndLocalDelegatedPropertyKt {
// source: 'memberExtensionPropertyAndLocalDelegatedProperty.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
private final static method box$lambda-1$lambda-0(p0: Delegate): java.lang.String
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@kotlin.Metadata
public final class O {
// source: 'memberExtensionPropertyAndLocalDelegatedProperty.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
static method <clinit>(): void
private method <init>(): void
public final @org.jetbrains.annotations.NotNull method getD(@org.jetbrains.annotations.NotNull p0: E): Delegate
}
@@ -0,0 +1,14 @@
// TARGET_BACKEND: JVM
// CHECK_BYTECODE_LISTING
// MODULE: lib
// FILE: file1.kt
val impl = 123
// MODULE: main(lib)
// FILE: file2.kt
operator fun Any?.getValue(thisRef: Any?, property: Any?) = "OK"
val s: String by impl
fun box() = s
@@ -0,0 +1,19 @@
Module: lib
@kotlin.Metadata
public final class File1Kt {
// source: 'file1.kt'
private final static field impl: int
static method <clinit>(): void
public final static method getImpl(): int
}
Module: main
@kotlin.Metadata
public final class File2Kt {
// source: 'file2.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final static field s$delegate: int
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,13 @@
// WITH_STDLIB
// CHECK_BYTECODE_LISTING
enum class E {
OK, NOT_OK
}
operator fun E.getValue(thisRef: Any?, property: Any?): String =
if (this == E.OK && thisRef == null) "OK" else "Failed"
val s: String by E.OK
fun box(): String = s
@@ -0,0 +1,22 @@
@kotlin.Metadata
public final class DelegateToEnumKt {
// source: 'delegateToEnum.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final static @org.jetbrains.annotations.NotNull field s$delegate: E
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: E, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final enum class E {
// source: 'delegateToEnum.kt'
private synthetic final static field $VALUES: E[]
public final enum static field NOT_OK: E
public final enum static field OK: E
static method <clinit>(): void
private method <init>(p0: java.lang.String, p1: int): void
public static method valueOf(p0: java.lang.String): E
public static method values(): E[]
}
@@ -0,0 +1,17 @@
// WITH_STDLIB
// CHECK_BYTECODE_LISTING
enum class E {
OK, NOT_OK
}
class C {
val s: String by E.OK
}
val c = C()
operator fun E.getValue(thisRef: Any?, property: Any?): String =
if (this == E.OK && thisRef == c) "OK" else "Failed"
fun box(): String = c.s
@@ -0,0 +1,31 @@
@kotlin.Metadata
public final class C {
// source: 'delegateToEnumInAClass.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final @org.jetbrains.annotations.NotNull field s$delegate: E
static method <clinit>(): void
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
}
@kotlin.Metadata
public final class DelegateToEnumInAClassKt {
// source: 'delegateToEnumInAClass.kt'
private final static @org.jetbrains.annotations.NotNull field c: C
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getC(): C
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: E, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final enum class E {
// source: 'delegateToEnumInAClass.kt'
private synthetic final static field $VALUES: E[]
public final enum static field NOT_OK: E
public final enum static field OK: E
static method <clinit>(): void
private method <init>(p0: java.lang.String, p1: int): void
public static method valueOf(p0: java.lang.String): E
public static method values(): E[]
}
@@ -0,0 +1,32 @@
@kotlin.Metadata
public final class C {
// source: 'delegateToEnumInAClass.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
public method <init>(): void
private static method getS$delegate(p0: C): java.lang.Object
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
}
@kotlin.Metadata
public final class DelegateToEnumInAClassKt {
// source: 'delegateToEnumInAClass.kt'
private final static @org.jetbrains.annotations.NotNull field c: C
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getC(): C
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: E, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final enum class E {
// source: 'delegateToEnumInAClass.kt'
private synthetic final static field $VALUES: E[]
public final enum static field NOT_OK: E
public final enum static field OK: E
private synthetic final static method $values(): E[]
static method <clinit>(): void
private method <init>(p0: java.lang.String, p1: int): void
public static method valueOf(p0: java.lang.String): E
public static method values(): E[]
}
@@ -0,0 +1,23 @@
@kotlin.Metadata
public final class DelegateToEnumKt {
// source: 'delegateToEnum.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
private static method getS$delegate(): java.lang.Object
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: E, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final enum class E {
// source: 'delegateToEnum.kt'
private synthetic final static field $VALUES: E[]
public final enum static field NOT_OK: E
public final enum static field OK: E
private synthetic final static method $values(): E[]
static method <clinit>(): void
private method <init>(p0: java.lang.String, p1: int): void
public static method valueOf(p0: java.lang.String): E
public static method values(): E[]
}
@@ -0,0 +1,25 @@
// WITH_STDLIB
// CHECK_BYTECODE_LISTING
// IGNORE_BACKEND: JS_IR
import kotlin.reflect.KProperty
import kotlin.test.assertEquals
object Store {
private val map = mutableMapOf<Pair<Any?, KProperty<*>>, String?>()
operator fun getValue(thisRef: Any?, property: KProperty<*>): String? = map[thisRef to property]
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String?) {
map[thisRef to property] = value
}
}
object O {
var s: String? by Store
}
fun box(): String? {
O.s = "OK"
return O.s
}
@@ -0,0 +1,28 @@
@kotlin.Metadata
public final class DelegateToSingletonKt {
// source: 'delegateToSingleton.kt'
public final static @org.jetbrains.annotations.Nullable method box(): java.lang.String
}
@kotlin.Metadata
public final class O {
// source: 'delegateToSingleton.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
private final static @org.jetbrains.annotations.Nullable field s$delegate: Store
static method <clinit>(): void
private method <init>(): void
public final @org.jetbrains.annotations.Nullable method getS(): java.lang.String
public final method setS(@org.jetbrains.annotations.Nullable p0: java.lang.String): void
}
@kotlin.Metadata
public final class Store {
// source: 'delegateToSingleton.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: Store
private final static field map: java.util.Map
static method <clinit>(): void
private method <init>(): void
public final @org.jetbrains.annotations.Nullable method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
public final method setValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty, @org.jetbrains.annotations.Nullable p2: java.lang.String): void
}
@@ -0,0 +1,28 @@
@kotlin.Metadata
public final class DelegateToSingletonKt {
// source: 'delegateToSingleton.kt'
public final static @org.jetbrains.annotations.Nullable method box(): java.lang.String
}
@kotlin.Metadata
public final class O {
// source: 'delegateToSingleton.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
static method <clinit>(): void
private method <init>(): void
private static method getS$delegate(p0: O): java.lang.Object
public final @org.jetbrains.annotations.Nullable method getS(): java.lang.String
public final method setS(@org.jetbrains.annotations.Nullable p0: java.lang.String): void
}
@kotlin.Metadata
public final class Store {
// source: 'delegateToSingleton.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: Store
private final static @org.jetbrains.annotations.NotNull field map: java.util.Map
static method <clinit>(): void
private method <init>(): void
public final @org.jetbrains.annotations.Nullable method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
public final method setValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty, @org.jetbrains.annotations.Nullable p2: java.lang.String): void
}
@@ -0,0 +1,15 @@
// WITH_STDLIB
// CHECK_BYTECODE_LISTING
object O {
object P
init {
throw IllegalStateException("O should not be initialized")
}
}
operator fun O.P.getValue(thisRef: Any?, property: Any?) = if (thisRef == null) "OK" else "Failed"
val result by O.P
fun box(): String = result
@@ -0,0 +1,28 @@
@kotlin.Metadata
public final class NoInitializationOfOuterClassKt {
// source: 'noInitializationOfOuterClass.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final static @org.jetbrains.annotations.NotNull field result$delegate: O$P
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getResult(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: O$P, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final class O$P {
// source: 'noInitializationOfOuterClass.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O$P
static method <clinit>(): void
private method <init>(): void
public final inner class O$P
}
@kotlin.Metadata
public final class O {
// source: 'noInitializationOfOuterClass.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
static method <clinit>(): void
private method <init>(): void
public final inner class O$P
}
@@ -0,0 +1,28 @@
@kotlin.Metadata
public final class NoInitializationOfOuterClassKt {
// source: 'noInitializationOfOuterClass.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
private static method getResult$delegate(): java.lang.Object
public final static @org.jetbrains.annotations.NotNull method getResult(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: O$P, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final class O$P {
// source: 'noInitializationOfOuterClass.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O$P
static method <clinit>(): void
private method <init>(): void
public final inner class O$P
}
@kotlin.Metadata
public final class O {
// source: 'noInitializationOfOuterClass.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
static method <clinit>(): void
private method <init>(): void
public final inner class O$P
}
@@ -0,0 +1,23 @@
// WITH_STDLIB
// CHECK_BYTECODE_LISTING
var initialized = false
object O {
init {
initialized = true
}
operator fun getValue(x: Any?, y: Any?): String {
throw RuntimeException()
}
}
class C {
val s: String by O
}
fun box(): String {
val c = C()
return if (initialized) "OK" else "FAILURE"
}
@@ -0,0 +1,27 @@
@kotlin.Metadata
public final class C {
// source: 'withSideEffects.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final @org.jetbrains.annotations.NotNull field s$delegate: O
static method <clinit>(): void
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
}
@kotlin.Metadata
public final class O {
// source: 'withSideEffects.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
static method <clinit>(): void
private method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final class WithSideEffectsKt {
// source: 'withSideEffects.kt'
private static field initialized: boolean
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method getInitialized(): boolean
public final static method setInitialized(p0: boolean): void
}
@@ -0,0 +1,19 @@
// WITH_STDLIB
// CHECK_BYTECODE_LISTING
var initialized = false
object O {
init {
initialized = true
}
operator fun getValue(x: Any?, y: Any?): String {
throw RuntimeException()
}
}
val s: String by O
fun box(): String = if (initialized) "OK" else "FAILURE"
@@ -0,0 +1,21 @@
@kotlin.Metadata
public final class O {
// source: 'withSideEffectsFromFileClass.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
static method <clinit>(): void
private method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final class WithSideEffectsFromFileClassKt {
// source: 'withSideEffectsFromFileClass.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private static field initialized: boolean
private final static @org.jetbrains.annotations.NotNull field s$delegate: O
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method getInitialized(): boolean
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static method setInitialized(p0: boolean): void
}
@@ -0,0 +1,21 @@
@kotlin.Metadata
public final class O {
// source: 'withSideEffectsFromFileClass.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
static method <clinit>(): void
private method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final class WithSideEffectsFromFileClassKt {
// source: 'withSideEffectsFromFileClass.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private static field initialized: boolean
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method getInitialized(): boolean
private static method getS$delegate(): java.lang.Object
public final static @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final static method setInitialized(p0: boolean): void
}
@@ -0,0 +1,22 @@
// WITH_STDLIB
// CHECK_BYTECODE_LISTING
var initialized = false
enum class E {
X;
companion object {
init {
initialized = true
}
}
}
operator fun Any?.getValue(x: Any?, y: Any?): String {
throw RuntimeException()
}
val result by E.X
fun box() = if (initialized) "OK" else "FAILURE"
@@ -0,0 +1,34 @@
@kotlin.Metadata
public final class E$Companion {
// source: 'withSideEffectsToEnum.kt'
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public final inner class E$Companion
}
@kotlin.Metadata
public final enum class E {
// source: 'withSideEffectsToEnum.kt'
private synthetic final static field $VALUES: E[]
public final static @org.jetbrains.annotations.NotNull field Companion: E$Companion
public final enum static field X: E
static method <clinit>(): void
private method <init>(p0: java.lang.String, p1: int): void
public static method valueOf(p0: java.lang.String): E
public static method values(): E[]
public final inner class E$Companion
}
@kotlin.Metadata
public final class WithSideEffectsToEnumKt {
// source: 'withSideEffectsToEnum.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private static field initialized: boolean
private final static @org.jetbrains.annotations.NotNull field result$delegate: E
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method getInitialized(): boolean
public final static @org.jetbrains.annotations.NotNull method getResult(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
public final static method setInitialized(p0: boolean): void
}
@@ -0,0 +1,35 @@
@kotlin.Metadata
public final class E$Companion {
// source: 'withSideEffectsToEnum.kt'
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public final inner class E$Companion
}
@kotlin.Metadata
public final enum class E {
// source: 'withSideEffectsToEnum.kt'
private synthetic final static field $VALUES: E[]
public final static @org.jetbrains.annotations.NotNull field Companion: E$Companion
public final enum static field X: E
private synthetic final static method $values(): E[]
static method <clinit>(): void
private method <init>(p0: java.lang.String, p1: int): void
public static method valueOf(p0: java.lang.String): E
public static method values(): E[]
public final inner class E$Companion
}
@kotlin.Metadata
public final class WithSideEffectsToEnumKt {
// source: 'withSideEffectsToEnum.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private static field initialized: boolean
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method getInitialized(): boolean
private static method getResult$delegate(): java.lang.Object
public final static @org.jetbrains.annotations.NotNull method getResult(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
public final static method setInitialized(p0: boolean): void
}
@@ -0,0 +1,28 @@
@kotlin.Metadata
public final class C {
// source: 'withSideEffects.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
public method <init>(): void
private static method getS$delegate(p0: C): java.lang.Object
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
}
@kotlin.Metadata
public final class O {
// source: 'withSideEffects.kt'
public final static @org.jetbrains.annotations.NotNull field INSTANCE: O
static method <clinit>(): void
private method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final class WithSideEffectsKt {
// source: 'withSideEffects.kt'
private static field initialized: boolean
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static method getInitialized(): boolean
public final static method setInitialized(p0: boolean): void
}
@@ -0,0 +1,13 @@
// WITH_STDLIB
// CHECK_BYTECODE_LISTING
class O {
operator fun getValue(thisRef: Any?, property: Any?) =
if (thisRef is I) "OK" else "Failed"
inner class I {
val s: String by this@O
}
}
fun box() = O().I().s
@@ -0,0 +1,25 @@
@kotlin.Metadata
public final class DelegateToOuterThisKt {
// source: 'delegateToOuterThis.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@kotlin.Metadata
public final class O$I {
// source: 'delegateToOuterThis.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final @org.jetbrains.annotations.NotNull field s$delegate: O
synthetic final field this$0: O
static method <clinit>(): void
public method <init>(p0: O): void
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final inner class O$I
}
@kotlin.Metadata
public final class O {
// source: 'delegateToOuterThis.kt'
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
public final inner class O$I
}
@@ -0,0 +1,25 @@
@kotlin.Metadata
public final class DelegateToOuterThisKt {
// source: 'delegateToOuterThis.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@kotlin.Metadata
public final class O$I {
// source: 'delegateToOuterThis.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
synthetic final field this$0: O
static method <clinit>(): void
public method <init>(p0: O): void
private static method getS$delegate(p0: O$I): java.lang.Object
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final inner class O$I
}
@kotlin.Metadata
public final class O {
// source: 'delegateToOuterThis.kt'
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
public final inner class O$I
}
@@ -0,0 +1,11 @@
// WITH_STDLIB
// CHECK_BYTECODE_LISTING
class C {
operator fun getValue(thisRef: Any?, property: Any?) =
if (thisRef == this) "OK" else "Failed"
val s: String by this
}
fun box() = C().s
@@ -0,0 +1,16 @@
@kotlin.Metadata
public final class C {
// source: 'delegateToThis.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final @org.jetbrains.annotations.NotNull field s$delegate: C
static method <clinit>(): void
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final class DelegateToThisKt {
// source: 'delegateToThis.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -0,0 +1,13 @@
// WITH_STDLIB
// CHECK_BYTECODE_LISTING
class C {
val s: String by this
}
val c = C()
operator fun C.getValue(thisRef: Any?, property: Any?) =
if (this == c && thisRef == c) "OK" else "Failed"
fun box() = c.s
@@ -0,0 +1,19 @@
@kotlin.Metadata
public final class C {
// source: 'delegateToThisByExtension.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final @org.jetbrains.annotations.NotNull field s$delegate: C
static method <clinit>(): void
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
}
@kotlin.Metadata
public final class DelegateToThisByExtensionKt {
// source: 'delegateToThisByExtension.kt'
private final static @org.jetbrains.annotations.NotNull field c: C
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getC(): C
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: C, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,19 @@
@kotlin.Metadata
public final class C {
// source: 'delegateToThisByExtension.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
public method <init>(): void
private static method getS$delegate(p0: C): java.lang.Object
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
}
@kotlin.Metadata
public final class DelegateToThisByExtensionKt {
// source: 'delegateToThisByExtension.kt'
private final static @org.jetbrains.annotations.NotNull field c: C
static method <clinit>(): void
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getC(): C
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: C, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.Nullable p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,16 @@
@kotlin.Metadata
public final class C {
// source: 'delegateToThis.kt'
synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
static method <clinit>(): void
public method <init>(): void
private static method getS$delegate(p0: C): java.lang.Object
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.Nullable p1: java.lang.Object): java.lang.String
}
@kotlin.Metadata
public final class DelegateToThisKt {
// source: 'delegateToThis.kt'
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -22,7 +22,7 @@ object Delegate {
fun box(): String {
assertEquals(
listOf("getIsFries", "getIsUpdateable", "setIsFries", "setIsUpdateable"),
TestIt::class.java.declaredMethods.map { it.name }.sorted()
TestIt::class.java.declaredMethods.map { it.name }.sorted() - "getIsUpdateable\$delegate"
)
return "OK"
@@ -0,0 +1,17 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
import kotlin.test.assertEquals
import kotlin.reflect.jvm.isAccessible
operator fun Any?.getValue(x: Any?, y: Any?): String {
return "OK"
}
val s: String by 1
fun box(): String {
assertEquals(1, ::s.apply { isAccessible = true }.getDelegate())
return "OK"
}
@@ -0,0 +1,18 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
import kotlin.reflect.jvm.isAccessible
import kotlin.test.assertEquals
operator fun Any?.getValue(x: Any?, y: Any?): String {
return "OK"
}
const val a = "TEXT"
val s: String by a
fun box(): String {
assertEquals("TEXT", ::s.apply { isAccessible = true }.getDelegate())
return "OK"
}
@@ -0,0 +1,18 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
import kotlin.test.assertEquals
import kotlin.reflect.jvm.isAccessible
enum class E {
OK, NOT_OK
}
operator fun E.getValue(x: Any?, y: Any?): String = name
val s: String by E.OK
fun box(): String {
assertEquals(E.OK, ::s.apply { isAccessible = true }.getDelegate())
return "OK"
}
@@ -0,0 +1,21 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
import kotlin.properties.ReadOnlyProperty
import kotlin.reflect.KProperty
import kotlin.reflect.jvm.isAccessible
import kotlin.test.assertEquals
object O {
val impl = 123
}
operator fun Any?.getValue(thisRef: Any?, property: KProperty<*>) = "OK"
val s: String by O.impl
fun box(): String {
assertEquals(123, ::s.apply { isAccessible = true }.getDelegate())
return "OK"
}
@@ -0,0 +1,18 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
import kotlin.reflect.KProperty
import kotlin.reflect.jvm.isAccessible
import kotlin.test.assertEquals
val impl = 123
operator fun Any?.getValue(thisRef: Any?, property: KProperty<*>) = "OK"
val s: String by impl
fun box(): String {
assertEquals(123, ::s.apply { isAccessible = true }.getDelegate())
return "OK"
}
@@ -0,0 +1,27 @@
// TARGET_BACKEND: JVM
// WITH_REFLECT
import kotlin.reflect.KProperty
import kotlin.reflect.jvm.isAccessible
import kotlin.test.assertEquals
object Store {
private val map = mutableMapOf<Pair<Any?, KProperty<*>>, String?>()
operator fun getValue(thisRef: Any?, property: KProperty<*>): String? = map[thisRef to property]
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String?) {
map[thisRef to property] = value
}
}
object O {
var s: String? by Store
}
fun box(): String {
assertEquals(Store, O::s.apply { isAccessible = true }.getDelegate())
return "OK"
}
@@ -14477,6 +14477,178 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToConst")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToConst {
@Test
public void testAllFilesPresentInDelegateToConst() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Test
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConst.kt");
}
@Test
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConstProperty.kt");
}
@Test
@TestMetadata("delegateToNull.kt")
public void testDelegateToNull() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToNull.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToFinalProperty {
@Test
public void testAllFilesPresentInDelegateToFinalProperty() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Test
@TestMetadata("chain.kt")
public void testChain() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/chain.kt");
}
@Test
@TestMetadata("delegateToFinalInstanceProperty.kt")
public void testDelegateToFinalInstanceProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalInstanceProperty.kt");
}
@Test
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalObjectProperty.kt");
}
@Test
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalProperty.kt");
}
@Test
@TestMetadata("finalPropertyInAnotherFile.kt")
public void testFinalPropertyInAnotherFile() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/finalPropertyInAnotherFile.kt");
}
@Test
@TestMetadata("initializeContainerOfTopLevelProperties.kt")
public void testInitializeContainerOfTopLevelProperties() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/initializeContainerOfTopLevelProperties.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndImportFromObject.kt")
public void testMemberExtensionPropertyAndImportFromObject() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndImportFromObject.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndLocalDelegatedProperty.kt")
public void testMemberExtensionPropertyAndLocalDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndLocalDelegatedProperty.kt");
}
@Test
@TestMetadata("multimodule.kt")
public void testMultimodule() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/multimodule.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToSingleton {
@Test
public void testAllFilesPresentInDelegateToSingleton() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Test
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnum.kt");
}
@Test
@TestMetadata("delegateToEnumInAClass.kt")
public void testDelegateToEnumInAClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnumInAClass.kt");
}
@Test
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToSingleton.kt");
}
@Test
@TestMetadata("noInitializationOfOuterClass.kt")
public void testNoInitializationOfOuterClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/noInitializationOfOuterClass.kt");
}
@Test
@TestMetadata("withSideEffects.kt")
public void testWithSideEffects() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffects.kt");
}
@Test
@TestMetadata("withSideEffectsFromFileClass.kt")
public void testWithSideEffectsFromFileClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsFromFileClass.kt");
}
@Test
@TestMetadata("withSideEffectsToEnum.kt")
public void testWithSideEffectsToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsToEnum.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToThis")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToThis {
@Test
public void testAllFilesPresentInDelegateToThis() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToThis"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@Test
@TestMetadata("delegateToOuterThis.kt")
public void testDelegateToOuterThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToOuterThis.kt");
}
@Test
@TestMetadata("delegateToThis.kt")
public void testDelegateToThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThis.kt");
}
@Test
@TestMetadata("delegateToThisByExtension.kt")
public void testDelegateToThisByExtension() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThisByExtension.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/local")
@TestDataPath("$PROJECT_ROOT")
@@ -42287,6 +42459,42 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
public void testDelegateToAnother() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToAnother.kt");
}
@Test
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToConst.kt");
}
@Test
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToConstProperty.kt");
}
@Test
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToEnum.kt");
}
@Test
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToFinalObjectProperty.kt");
}
@Test
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToFinalProperty.kt");
}
@Test
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToSingleton.kt");
}
}
}
@@ -14597,6 +14597,178 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToConst")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToConst {
@Test
public void testAllFilesPresentInDelegateToConst() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConst.kt");
}
@Test
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConstProperty.kt");
}
@Test
@TestMetadata("delegateToNull.kt")
public void testDelegateToNull() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToNull.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToFinalProperty {
@Test
public void testAllFilesPresentInDelegateToFinalProperty() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("chain.kt")
public void testChain() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/chain.kt");
}
@Test
@TestMetadata("delegateToFinalInstanceProperty.kt")
public void testDelegateToFinalInstanceProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalInstanceProperty.kt");
}
@Test
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalObjectProperty.kt");
}
@Test
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalProperty.kt");
}
@Test
@TestMetadata("finalPropertyInAnotherFile.kt")
public void testFinalPropertyInAnotherFile() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/finalPropertyInAnotherFile.kt");
}
@Test
@TestMetadata("initializeContainerOfTopLevelProperties.kt")
public void testInitializeContainerOfTopLevelProperties() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/initializeContainerOfTopLevelProperties.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndImportFromObject.kt")
public void testMemberExtensionPropertyAndImportFromObject() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndImportFromObject.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndLocalDelegatedProperty.kt")
public void testMemberExtensionPropertyAndLocalDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndLocalDelegatedProperty.kt");
}
@Test
@TestMetadata("multimodule.kt")
public void testMultimodule() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/multimodule.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToSingleton {
@Test
public void testAllFilesPresentInDelegateToSingleton() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnum.kt");
}
@Test
@TestMetadata("delegateToEnumInAClass.kt")
public void testDelegateToEnumInAClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnumInAClass.kt");
}
@Test
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToSingleton.kt");
}
@Test
@TestMetadata("noInitializationOfOuterClass.kt")
public void testNoInitializationOfOuterClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/noInitializationOfOuterClass.kt");
}
@Test
@TestMetadata("withSideEffects.kt")
public void testWithSideEffects() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffects.kt");
}
@Test
@TestMetadata("withSideEffectsFromFileClass.kt")
public void testWithSideEffectsFromFileClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsFromFileClass.kt");
}
@Test
@TestMetadata("withSideEffectsToEnum.kt")
public void testWithSideEffectsToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsToEnum.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToThis")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToThis {
@Test
public void testAllFilesPresentInDelegateToThis() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToThis"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("delegateToOuterThis.kt")
public void testDelegateToOuterThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToOuterThis.kt");
}
@Test
@TestMetadata("delegateToThis.kt")
public void testDelegateToThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThis.kt");
}
@Test
@TestMetadata("delegateToThisByExtension.kt")
public void testDelegateToThisByExtension() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThisByExtension.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/local")
@TestDataPath("$PROJECT_ROOT")
@@ -42815,6 +42987,42 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
public void testDelegateToAnother() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToAnother.kt");
}
@Test
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToConst.kt");
}
@Test
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToConstProperty.kt");
}
@Test
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToEnum.kt");
}
@Test
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToFinalObjectProperty.kt");
}
@Test
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToFinalProperty.kt");
}
@Test
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToSingleton.kt");
}
}
}
@@ -11809,6 +11809,168 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToConst")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DelegateToConst extends AbstractLightAnalysisModeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInDelegateToConst() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConst.kt");
}
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConstProperty.kt");
}
@TestMetadata("delegateToNull.kt")
public void testDelegateToNull() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToNull.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DelegateToFinalProperty extends AbstractLightAnalysisModeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInDelegateToFinalProperty() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("chain.kt")
public void testChain() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/chain.kt");
}
@TestMetadata("delegateToFinalInstanceProperty.kt")
public void testDelegateToFinalInstanceProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalInstanceProperty.kt");
}
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalObjectProperty.kt");
}
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalProperty.kt");
}
@TestMetadata("finalPropertyInAnotherFile.kt")
public void testFinalPropertyInAnotherFile() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/finalPropertyInAnotherFile.kt");
}
@TestMetadata("initializeContainerOfTopLevelProperties.kt")
public void testInitializeContainerOfTopLevelProperties() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/initializeContainerOfTopLevelProperties.kt");
}
@TestMetadata("memberExtensionPropertyAndImportFromObject.kt")
public void testMemberExtensionPropertyAndImportFromObject() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndImportFromObject.kt");
}
@TestMetadata("memberExtensionPropertyAndLocalDelegatedProperty.kt")
public void testMemberExtensionPropertyAndLocalDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndLocalDelegatedProperty.kt");
}
@TestMetadata("multimodule.kt")
public void testMultimodule() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/multimodule.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DelegateToSingleton extends AbstractLightAnalysisModeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInDelegateToSingleton() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnum.kt");
}
@TestMetadata("delegateToEnumInAClass.kt")
public void testDelegateToEnumInAClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnumInAClass.kt");
}
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToSingleton.kt");
}
@TestMetadata("noInitializationOfOuterClass.kt")
public void testNoInitializationOfOuterClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/noInitializationOfOuterClass.kt");
}
@TestMetadata("withSideEffects.kt")
public void testWithSideEffects() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffects.kt");
}
@TestMetadata("withSideEffectsFromFileClass.kt")
public void testWithSideEffectsFromFileClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsFromFileClass.kt");
}
@TestMetadata("withSideEffectsToEnum.kt")
public void testWithSideEffectsToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsToEnum.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToThis")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DelegateToThis extends AbstractLightAnalysisModeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInDelegateToThis() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToThis"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("delegateToOuterThis.kt")
public void testDelegateToOuterThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToOuterThis.kt");
}
@TestMetadata("delegateToThis.kt")
public void testDelegateToThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThis.kt");
}
@TestMetadata("delegateToThisByExtension.kt")
public void testDelegateToThisByExtension() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThisByExtension.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/local")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -34018,6 +34180,36 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
public void testDelegateToAnother() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToAnother.kt");
}
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToConst.kt");
}
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToConstProperty.kt");
}
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToEnum.kt");
}
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToFinalObjectProperty.kt");
}
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToFinalProperty.kt");
}
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/reflection/properties/getDelegate/method/delegateToSingleton.kt");
}
}
}
@@ -11041,6 +11041,172 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToConst")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToConst {
@Test
public void testAllFilesPresentInDelegateToConst() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@Test
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConst.kt");
}
@Test
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConstProperty.kt");
}
@Test
@TestMetadata("delegateToNull.kt")
public void testDelegateToNull() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToNull.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToFinalProperty {
@Test
public void testAllFilesPresentInDelegateToFinalProperty() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@Test
@TestMetadata("chain.kt")
public void testChain() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/chain.kt");
}
@Test
@TestMetadata("delegateToFinalInstanceProperty.kt")
public void testDelegateToFinalInstanceProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalInstanceProperty.kt");
}
@Test
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalObjectProperty.kt");
}
@Test
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalProperty.kt");
}
@Test
@TestMetadata("finalPropertyInAnotherFile.kt")
public void testFinalPropertyInAnotherFile() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/finalPropertyInAnotherFile.kt");
}
@Test
@TestMetadata("initializeContainerOfTopLevelProperties.kt")
public void testInitializeContainerOfTopLevelProperties() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/initializeContainerOfTopLevelProperties.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndImportFromObject.kt")
public void testMemberExtensionPropertyAndImportFromObject() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndImportFromObject.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndLocalDelegatedProperty.kt")
public void testMemberExtensionPropertyAndLocalDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndLocalDelegatedProperty.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToSingleton {
@Test
public void testAllFilesPresentInDelegateToSingleton() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@Test
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnum.kt");
}
@Test
@TestMetadata("delegateToEnumInAClass.kt")
public void testDelegateToEnumInAClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnumInAClass.kt");
}
@Test
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToSingleton.kt");
}
@Test
@TestMetadata("noInitializationOfOuterClass.kt")
public void testNoInitializationOfOuterClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/noInitializationOfOuterClass.kt");
}
@Test
@TestMetadata("withSideEffects.kt")
public void testWithSideEffects() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffects.kt");
}
@Test
@TestMetadata("withSideEffectsFromFileClass.kt")
public void testWithSideEffectsFromFileClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsFromFileClass.kt");
}
@Test
@TestMetadata("withSideEffectsToEnum.kt")
public void testWithSideEffectsToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsToEnum.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToThis")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToThis {
@Test
public void testAllFilesPresentInDelegateToThis() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToThis"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@Test
@TestMetadata("delegateToOuterThis.kt")
public void testDelegateToOuterThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToOuterThis.kt");
}
@Test
@TestMetadata("delegateToThis.kt")
public void testDelegateToThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThis.kt");
}
@Test
@TestMetadata("delegateToThisByExtension.kt")
public void testDelegateToThisByExtension() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThisByExtension.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/local")
@TestDataPath("$PROJECT_ROOT")
@@ -11083,6 +11083,172 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToConst")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToConst {
@Test
public void testAllFilesPresentInDelegateToConst() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConst.kt");
}
@Test
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConstProperty.kt");
}
@Test
@TestMetadata("delegateToNull.kt")
public void testDelegateToNull() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToNull.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToFinalProperty {
@Test
public void testAllFilesPresentInDelegateToFinalProperty() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("chain.kt")
public void testChain() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/chain.kt");
}
@Test
@TestMetadata("delegateToFinalInstanceProperty.kt")
public void testDelegateToFinalInstanceProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalInstanceProperty.kt");
}
@Test
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalObjectProperty.kt");
}
@Test
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalProperty.kt");
}
@Test
@TestMetadata("finalPropertyInAnotherFile.kt")
public void testFinalPropertyInAnotherFile() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/finalPropertyInAnotherFile.kt");
}
@Test
@TestMetadata("initializeContainerOfTopLevelProperties.kt")
public void testInitializeContainerOfTopLevelProperties() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/initializeContainerOfTopLevelProperties.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndImportFromObject.kt")
public void testMemberExtensionPropertyAndImportFromObject() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndImportFromObject.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndLocalDelegatedProperty.kt")
public void testMemberExtensionPropertyAndLocalDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndLocalDelegatedProperty.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToSingleton {
@Test
public void testAllFilesPresentInDelegateToSingleton() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnum.kt");
}
@Test
@TestMetadata("delegateToEnumInAClass.kt")
public void testDelegateToEnumInAClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnumInAClass.kt");
}
@Test
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToSingleton.kt");
}
@Test
@TestMetadata("noInitializationOfOuterClass.kt")
public void testNoInitializationOfOuterClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/noInitializationOfOuterClass.kt");
}
@Test
@TestMetadata("withSideEffects.kt")
public void testWithSideEffects() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffects.kt");
}
@Test
@TestMetadata("withSideEffectsFromFileClass.kt")
public void testWithSideEffectsFromFileClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsFromFileClass.kt");
}
@Test
@TestMetadata("withSideEffectsToEnum.kt")
public void testWithSideEffectsToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsToEnum.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToThis")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToThis {
@Test
public void testAllFilesPresentInDelegateToThis() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToThis"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("delegateToOuterThis.kt")
public void testDelegateToOuterThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToOuterThis.kt");
}
@Test
@TestMetadata("delegateToThis.kt")
public void testDelegateToThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThis.kt");
}
@Test
@TestMetadata("delegateToThisByExtension.kt")
public void testDelegateToThisByExtension() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThisByExtension.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/local")
@TestDataPath("$PROJECT_ROOT")
@@ -9804,6 +9804,163 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToConst")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DelegateToConst extends AbstractIrCodegenBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInDelegateToConst() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToConst"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConst.kt");
}
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConstProperty.kt");
}
@TestMetadata("delegateToNull.kt")
public void testDelegateToNull() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToNull.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DelegateToFinalProperty extends AbstractIrCodegenBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInDelegateToFinalProperty() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("chain.kt")
public void testChain() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/chain.kt");
}
@TestMetadata("delegateToFinalInstanceProperty.kt")
public void testDelegateToFinalInstanceProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalInstanceProperty.kt");
}
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalObjectProperty.kt");
}
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalProperty.kt");
}
@TestMetadata("finalPropertyInAnotherFile.kt")
public void testFinalPropertyInAnotherFile() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/finalPropertyInAnotherFile.kt");
}
@TestMetadata("initializeContainerOfTopLevelProperties.kt")
public void testInitializeContainerOfTopLevelProperties() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/initializeContainerOfTopLevelProperties.kt");
}
@TestMetadata("memberExtensionPropertyAndImportFromObject.kt")
public void testMemberExtensionPropertyAndImportFromObject() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndImportFromObject.kt");
}
@TestMetadata("memberExtensionPropertyAndLocalDelegatedProperty.kt")
public void testMemberExtensionPropertyAndLocalDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndLocalDelegatedProperty.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DelegateToSingleton extends AbstractIrCodegenBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInDelegateToSingleton() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnum.kt");
}
@TestMetadata("delegateToEnumInAClass.kt")
public void testDelegateToEnumInAClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnumInAClass.kt");
}
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToSingleton.kt");
}
@TestMetadata("noInitializationOfOuterClass.kt")
public void testNoInitializationOfOuterClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/noInitializationOfOuterClass.kt");
}
@TestMetadata("withSideEffects.kt")
public void testWithSideEffects() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffects.kt");
}
@TestMetadata("withSideEffectsFromFileClass.kt")
public void testWithSideEffectsFromFileClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsFromFileClass.kt");
}
@TestMetadata("withSideEffectsToEnum.kt")
public void testWithSideEffectsToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsToEnum.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToThis")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DelegateToThis extends AbstractIrCodegenBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInDelegateToThis() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToThis"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("delegateToOuterThis.kt")
public void testDelegateToOuterThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToOuterThis.kt");
}
@TestMetadata("delegateToThis.kt")
public void testDelegateToThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThis.kt");
}
@TestMetadata("delegateToThisByExtension.kt")
public void testDelegateToThisByExtension() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThisByExtension.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/local")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
+1 -1
View File
@@ -35,8 +35,8 @@ public final class C : kotlin/Any {
public final /* delegated */ val withOptimizedDelegate: kotlin/Double
public final /* non-default */ get
// field: delegated$delegate:Ljava/lang/Void;
// getter: getDelegated(Ljava/lang/Number;)Ljava/util/List;
// synthetic method for delegate: getDelegated$delegate(LC;Ljava/lang/Number;)Ljava/lang/Object;
public final /* delegated */ val <T#0 /* T */ : kotlin/Number> T#0.delegated: kotlin/collections/List<kotlin/Nothing>
public final /* non-default */ get
@@ -12043,6 +12043,180 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToConst")
@TestDataPath("$PROJECT_ROOT")
@Tag("codegen")
@UseExtTestCaseGroupProvider()
public class DelegateToConst {
@Test
public void testAllFilesPresentInDelegateToConst() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConst.kt");
}
@Test
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConstProperty.kt");
}
@Test
@TestMetadata("delegateToNull.kt")
public void testDelegateToNull() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToNull.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty")
@TestDataPath("$PROJECT_ROOT")
@Tag("codegen")
@UseExtTestCaseGroupProvider()
public class DelegateToFinalProperty {
@Test
public void testAllFilesPresentInDelegateToFinalProperty() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("chain.kt")
public void testChain() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/chain.kt");
}
@Test
@TestMetadata("delegateToFinalInstanceProperty.kt")
public void testDelegateToFinalInstanceProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalInstanceProperty.kt");
}
@Test
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalObjectProperty.kt");
}
@Test
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalProperty.kt");
}
@Test
@TestMetadata("finalPropertyInAnotherFile.kt")
public void testFinalPropertyInAnotherFile() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/finalPropertyInAnotherFile.kt");
}
@Test
@TestMetadata("initializeContainerOfTopLevelProperties.kt")
public void testInitializeContainerOfTopLevelProperties() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/initializeContainerOfTopLevelProperties.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndImportFromObject.kt")
public void testMemberExtensionPropertyAndImportFromObject() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndImportFromObject.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndLocalDelegatedProperty.kt")
public void testMemberExtensionPropertyAndLocalDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndLocalDelegatedProperty.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton")
@TestDataPath("$PROJECT_ROOT")
@Tag("codegen")
@UseExtTestCaseGroupProvider()
public class DelegateToSingleton {
@Test
public void testAllFilesPresentInDelegateToSingleton() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnum.kt");
}
@Test
@TestMetadata("delegateToEnumInAClass.kt")
public void testDelegateToEnumInAClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnumInAClass.kt");
}
@Test
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToSingleton.kt");
}
@Test
@TestMetadata("noInitializationOfOuterClass.kt")
public void testNoInitializationOfOuterClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/noInitializationOfOuterClass.kt");
}
@Test
@TestMetadata("withSideEffects.kt")
public void testWithSideEffects() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffects.kt");
}
@Test
@TestMetadata("withSideEffectsFromFileClass.kt")
public void testWithSideEffectsFromFileClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsFromFileClass.kt");
}
@Test
@TestMetadata("withSideEffectsToEnum.kt")
public void testWithSideEffectsToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsToEnum.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToThis")
@TestDataPath("$PROJECT_ROOT")
@Tag("codegen")
@UseExtTestCaseGroupProvider()
public class DelegateToThis {
@Test
public void testAllFilesPresentInDelegateToThis() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToThis"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("delegateToOuterThis.kt")
public void testDelegateToOuterThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToOuterThis.kt");
}
@Test
@TestMetadata("delegateToThis.kt")
public void testDelegateToThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThis.kt");
}
@Test
@TestMetadata("delegateToThisByExtension.kt")
public void testDelegateToThisByExtension() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThisByExtension.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/local")
@TestDataPath("$PROJECT_ROOT")