toDelegateFor: JVM BE implementation

This commit is contained in:
Dmitry Petrov
2016-12-06 17:31:02 +03:00
committed by Stanislav Erokhin
parent e2b6d2d849
commit 97d5bbf1c2
16 changed files with 464 additions and 27 deletions
@@ -30,7 +30,6 @@ import org.jetbrains.kotlin.codegen.inline.*;
import org.jetbrains.kotlin.codegen.serialization.JvmSerializerExtension;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
import org.jetbrains.kotlin.config.LanguageVersionSettings;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
import org.jetbrains.kotlin.descriptors.impl.SimpleFunctionDescriptorImpl;
@@ -46,6 +45,7 @@ import org.jetbrains.kotlin.psi.synthetics.SyntheticClassOrObjectDescriptor;
import org.jetbrains.kotlin.resolve.BindingContext;
import org.jetbrains.kotlin.resolve.BindingContextUtils;
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
import org.jetbrains.kotlin.resolve.jvm.AsmTypes;
@@ -58,6 +58,7 @@ import org.jetbrains.kotlin.storage.LockBasedStorageManager;
import org.jetbrains.kotlin.storage.NotNullLazyValue;
import org.jetbrains.kotlin.types.ErrorUtils;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.util.OperatorNameConventions;
import org.jetbrains.org.objectweb.asm.*;
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
import org.jetbrains.org.objectweb.asm.commons.Method;
@@ -66,6 +67,7 @@ import java.util.*;
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
import static org.jetbrains.kotlin.descriptors.CallableMemberDescriptor.Kind.SYNTHESIZED;
import static org.jetbrains.kotlin.resolve.BindingContext.TO_DELEGATE_FOR_RESOLVED_CALL;
import static org.jetbrains.kotlin.resolve.BindingContext.TYPE_ALIAS;
import static org.jetbrains.kotlin.resolve.BindingContext.VARIABLE;
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
@@ -462,10 +464,29 @@ public abstract class MemberCodegen<T extends KtPureElement/* TODO: & KtDeclarat
KtExpression initializer = property.getDelegateExpressionOrInitializer();
assert initializer != null : "shouldInitializeProperty must return false if initializer is null";
StackValue.Property propValue = codegen.intermediateValueForProperty(propertyDescriptor, true, false, null, true, StackValue.LOCAL_0,
null);
StackValue.Property propValue = codegen.intermediateValueForProperty(
propertyDescriptor, true, false, null, true, StackValue.LOCAL_0, null);
ResolvedCall<FunctionDescriptor> toDelegateForResolvedCall = bindingContext.get(TO_DELEGATE_FOR_RESOLVED_CALL, propertyDescriptor);
if (toDelegateForResolvedCall == null) {
propValue.store(codegen.gen(initializer), codegen.v);
return;
}
StackValue toDelegateForReceiver = codegen.gen(initializer);
int indexOfDelegatedProperty = PropertyCodegen.indexOfDelegatedProperty(property);
List<? extends ValueArgument> arguments = toDelegateForResolvedCall.getCall().getValueArguments();
assert arguments.size() == 2 :
"Resolved call for '" + OperatorNameConventions.TO_DELEGATE_FOR.asString() + "' should have exactly 2 value parameters";
codegen.tempVariables.put(arguments.get(0).asElement(), StackValue.LOCAL_0);
StackValue delegateValue = PropertyCodegen.invokeDelegatedPropertyConventionMethodWithReceiver(
codegen, typeMapper, toDelegateForResolvedCall, indexOfDelegatedProperty, 1, toDelegateForReceiver);
propValue.store(delegateValue, codegen.v);
propValue.store(codegen.gen(initializer), codegen.v);
}
protected boolean shouldInitializeProperty(@NotNull KtProperty property) {
@@ -25,7 +25,6 @@ import org.jetbrains.kotlin.codegen.annotation.AnnotatedWithFakeAnnotations;
import org.jetbrains.kotlin.codegen.context.*;
import org.jetbrains.kotlin.codegen.state.GenerationState;
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper;
import org.jetbrains.kotlin.config.LanguageVersionSettings;
import org.jetbrains.kotlin.descriptors.*;
import org.jetbrains.kotlin.descriptors.annotations.Annotated;
import org.jetbrains.kotlin.descriptors.annotations.AnnotationSplitter;
@@ -367,16 +366,33 @@ public class PropertyCodegen {
@NotNull PropertyDescriptor propertyDescriptor,
@NotNull Annotations annotations
) {
KtExpression delegateExpression = p.getDelegateExpression();
KotlinType delegateType = delegateExpression != null ? bindingContext.getType(p.getDelegateExpression()) : null;
if (delegateType == null) {
// If delegate expression is unresolved reference
delegateType = ErrorUtils.createErrorType("Delegate type");
}
KotlinType delegateType = getDelegateTypeForProperty(p, propertyDescriptor);
generateBackingField(p, propertyDescriptor, true, delegateType, null, annotations);
}
@NotNull
private KotlinType getDelegateTypeForProperty(@NotNull KtProperty p, @NotNull PropertyDescriptor propertyDescriptor) {
KotlinType delegateType = null;
ResolvedCall<FunctionDescriptor> toDelegateForResolvedCall =
bindingContext.get(BindingContext.TO_DELEGATE_FOR_RESOLVED_CALL, propertyDescriptor);
KtExpression delegateExpression = p.getDelegateExpression();
if (toDelegateForResolvedCall != null) {
delegateType = toDelegateForResolvedCall.getResultingDescriptor().getReturnType();
}
else if (delegateExpression != null) {
delegateType = bindingContext.getType(delegateExpression);
}
if (delegateType == null) {
// Delegation convention is unresolved
delegateType = ErrorUtils.createErrorType("Delegate type");
}
return delegateType;
}
private void generateBackingFieldAccess(
@NotNull KtNamedDeclaration p,
@NotNull PropertyDescriptor propertyDescriptor,
@@ -519,20 +535,22 @@ public class PropertyCodegen {
final int indexInPropertyMetadataArray,
int propertyMetadataArgumentIndex
) {
CodegenContext<? extends ClassOrPackageFragmentDescriptor> ownerContext = codegen.getContext().getClassOrPackageParentContext();
final Type owner;
if (ownerContext instanceof ClassContext) {
owner = typeMapper.mapClass(((ClassContext) ownerContext).getContextDescriptor());
}
else if (ownerContext instanceof PackageContext) {
owner = ((PackageContext) ownerContext).getPackagePartType();
}
else if (ownerContext instanceof MultifileClassContextBase) {
owner = ((MultifileClassContextBase) ownerContext).getFilePartType();
}
else {
throw new UnsupportedOperationException("Unknown context: " + ownerContext);
}
StackValue.Property receiver = codegen.intermediateValueForProperty(propertyDescriptor, true, null, StackValue.LOCAL_0);
return invokeDelegatedPropertyConventionMethodWithReceiver(
codegen, typeMapper, resolvedCall, indexInPropertyMetadataArray, propertyMetadataArgumentIndex,
receiver
);
}
public static StackValue invokeDelegatedPropertyConventionMethodWithReceiver(
@NotNull ExpressionCodegen codegen,
@NotNull KotlinTypeMapper typeMapper,
@NotNull ResolvedCall<FunctionDescriptor> resolvedCall,
final int indexInPropertyMetadataArray,
int propertyMetadataArgumentIndex,
@Nullable StackValue receiver
) {
final Type owner = getDelegatedPropertyMetadataOwner(codegen, typeMapper);
codegen.tempVariables.put(
resolvedCall.getCall().getValueArguments().get(propertyMetadataArgumentIndex).asElement(),
@@ -549,8 +567,23 @@ public class PropertyCodegen {
}
);
StackValue delegatedProperty = codegen.intermediateValueForProperty(propertyDescriptor, true, null, StackValue.LOCAL_0);
return codegen.invokeFunction(resolvedCall, delegatedProperty);
return codegen.invokeFunction(resolvedCall, receiver);
}
private static Type getDelegatedPropertyMetadataOwner(@NotNull ExpressionCodegen codegen, @NotNull KotlinTypeMapper typeMapper) {
CodegenContext<? extends ClassOrPackageFragmentDescriptor> ownerContext = codegen.getContext().getClassOrPackageParentContext();
if (ownerContext instanceof ClassContext) {
return typeMapper.mapClass(((ClassContext) ownerContext).getContextDescriptor());
}
else if (ownerContext instanceof PackageContext) {
return ((PackageContext) ownerContext).getPackagePartType();
}
else if (ownerContext instanceof MultifileClassContextBase) {
return ((MultifileClassContextBase) ownerContext).getFilePartType();
}
else {
throw new UnsupportedOperationException("Unknown context: " + ownerContext);
}
}
private static class DelegatedPropertyAccessorStrategy extends FunctionGenerationStrategy.CodegenBased {
@@ -0,0 +1,26 @@
// WITH_RUNTIME
// IGNORE_BACKEND: JS
import kotlin.test.*
var log: String = ""
inline fun <T> runLogged(entry: String, action: () -> T): T {
log += entry
return action()
}
operator fun String.toDelegateFor(host: Any?, p: Any): String =
runLogged("tdf($this);") { this }
operator fun String.getValue(receiver: Any?, p: Any): String =
runLogged("get($this);") { this }
val testO by runLogged("O;") { "O" }
val testK by runLogged("K;") { "K" }
val testOK = runLogged("OK;") { testO + testK }
fun box(): String {
assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log)
return testOK
}
@@ -0,0 +1,30 @@
// WITH_RUNTIME
// IGNORE_BACKEND: JS
import kotlin.test.*
var log: String = ""
inline fun <T> runLogged(entry: String, action: () -> T): T {
log += entry
return action()
}
operator fun String.toDelegateFor(host: Any?, p: Any): String =
runLogged("tdf($this);") { this }
operator fun String.getValue(receiver: Any?, p: Any): String =
runLogged("get($this);") { this }
class Test {
val testO by runLogged("O;") { "O" }
val testK by runLogged("K;") { "K" }
val testOK = runLogged("OK;") { testO + testK }
}
fun box(): String {
assertEquals("", log)
val test = Test()
assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log)
return test.testOK
}
@@ -0,0 +1,26 @@
// WITH_RUNTIME
// IGNORE_BACKEND: JS
import kotlin.test.*
var log: String = ""
inline fun <T> runLogged(entry: String, action: () -> T): T {
log += entry
return action()
}
inline operator fun String.toDelegateFor(host: Any?, p: Any): String =
runLogged("tdf($this);") { this }
operator fun String.getValue(receiver: Any?, p: Any): String =
runLogged("get($this);") { this }
val testO by runLogged("O;") { "O" }
val testK by runLogged("K;") { "K" }
val testOK = runLogged("OK;") { testO + testK }
fun box(): String {
assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log)
return testOK
}
@@ -0,0 +1,31 @@
// WITH_RUNTIME
// IGNORE_BACKEND: JS
import kotlin.test.*
var log: String = ""
inline fun <T> runLogged(entry: String, action: () -> T): T {
log += entry
return action()
}
operator fun String.toDelegateFor(host: Any?, p: Any): String =
runLogged("tdf($this);") { this }
operator fun String.getValue(receiver: Any?, p: Any): String =
runLogged("get($this);") { this }
object Test {
fun foo() {}
@JvmStatic val testO by runLogged("O;") { "O" }
@JvmStatic val testK by runLogged("K;") { "K" }
@JvmStatic val testOK = runLogged("OK;") { testO + testK }
}
fun box(): String {
assertEquals("", log)
Test.foo()
assertEquals("O;tdf(O);K;tdf(K);OK;get(O);get(K);", log)
return Test.testOK
}
@@ -0,0 +1,16 @@
// WITH_RUNTIME
// IGNORE_BACKEND: JS
object Host {
class StringDelegate(val s: String) {
operator fun getValue(receiver: String, p: Any) = receiver + s
}
operator fun String.toDelegateFor(host: Any?, p: Any) = StringDelegate(this)
val String.plusK by "K"
val ok = "O".plusK
}
fun box(): String = Host.ok
@@ -0,0 +1,16 @@
public final class EvaluationOrderKt {
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private static @org.jetbrains.annotations.NotNull field log: java.lang.String
private final static @org.jetbrains.annotations.NotNull field testK$delegate: java.lang.String
private final static @org.jetbrains.annotations.NotNull field testO$delegate: java.lang.String
private final static @org.jetbrains.annotations.NotNull field testOK: java.lang.String
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getLog(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getTestK(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getTestO(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getTestOK(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.NotNull p2: java.lang.Object): java.lang.String
public final static method runLogged(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function0): java.lang.Object
public final static method setLog(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
public final static @org.jetbrains.annotations.NotNull method toDelegateFor(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.NotNull p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,21 @@
public final class InClassKt {
private static @org.jetbrains.annotations.NotNull field log: java.lang.String
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getLog(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.NotNull p2: java.lang.Object): java.lang.String
public final static method runLogged(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function0): java.lang.Object
public final static method setLog(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
public final static @org.jetbrains.annotations.NotNull method toDelegateFor(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.NotNull p2: java.lang.Object): java.lang.String
}
public final class Test {
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private final @org.jetbrains.annotations.NotNull field testK$delegate: java.lang.String
private final @org.jetbrains.annotations.NotNull field testO$delegate: java.lang.String
private final @org.jetbrains.annotations.NotNull field testOK: java.lang.String
public method <init>(): void
public final @org.jetbrains.annotations.NotNull method getTestK(): java.lang.String
public final @org.jetbrains.annotations.NotNull method getTestO(): java.lang.String
public final @org.jetbrains.annotations.NotNull method getTestOK(): java.lang.String
}
@@ -0,0 +1,16 @@
public final class InlineToDelegateForKt {
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
private static @org.jetbrains.annotations.NotNull field log: java.lang.String
private final static @org.jetbrains.annotations.NotNull field testK$delegate: java.lang.String
private final static @org.jetbrains.annotations.NotNull field testO$delegate: java.lang.String
private final static @org.jetbrains.annotations.NotNull field testOK: java.lang.String
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getLog(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getTestK(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getTestO(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getTestOK(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.NotNull p2: java.lang.Object): java.lang.String
public final static method runLogged(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function0): java.lang.Object
public final static method setLog(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
public final static @org.jetbrains.annotations.NotNull method toDelegateFor(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.NotNull p2: java.lang.Object): java.lang.String
}
@@ -0,0 +1,26 @@
public final class JvmStaticInObjectKt {
private static @org.jetbrains.annotations.NotNull field log: java.lang.String
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getLog(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.NotNull p2: java.lang.Object): java.lang.String
public final static method runLogged(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: kotlin.jvm.functions.Function0): java.lang.Object
public final static method setLog(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
public final static @org.jetbrains.annotations.NotNull method toDelegateFor(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.NotNull p2: java.lang.Object): java.lang.String
}
public final class Test {
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
public final static field INSTANCE: Test
private final static @org.jetbrains.annotations.NotNull field testK$delegate: java.lang.String
private final static @org.jetbrains.annotations.NotNull field testO$delegate: java.lang.String
private final static @org.jetbrains.annotations.NotNull field testOK: java.lang.String
private method <init>(): void
public final method foo(): void
public final static @org.jetbrains.annotations.NotNull method getTestK(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getTestO(): java.lang.String
public final static @org.jetbrains.annotations.NotNull method getTestOK(): java.lang.String
private synthetic deprecated static @kotlin.jvm.JvmStatic method testK$annotations(): void
private synthetic deprecated static @kotlin.jvm.JvmStatic method testO$annotations(): void
private synthetic deprecated static @kotlin.jvm.JvmStatic method testOK$annotations(): void
}
@@ -0,0 +1,25 @@
public final class Host {
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
public final static field INSTANCE: Host
private final static @org.jetbrains.annotations.NotNull field ok: java.lang.String
private final static @org.jetbrains.annotations.NotNull field plusK$delegate: Host.StringDelegate
inner class Host/StringDelegate
private method <init>(): void
public final @org.jetbrains.annotations.NotNull method getOk(): java.lang.String
public final @org.jetbrains.annotations.NotNull method getPlusK(@org.jetbrains.annotations.NotNull p0: java.lang.String): java.lang.String
public final @org.jetbrains.annotations.NotNull method toDelegateFor(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.Nullable p1: java.lang.Object, @org.jetbrains.annotations.NotNull p2: java.lang.Object): Host.StringDelegate
}
public final static class Host/StringDelegate {
private final @org.jetbrains.annotations.NotNull field s: java.lang.String
inner class Host/StringDelegate
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: java.lang.Object): java.lang.String
}
public final class MemberExtensionKt {
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
}
@@ -6001,11 +6001,41 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/toDelegateFor"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("evaluationOrder.kt")
public void testEvaluationOrder() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/evaluationOrder.kt");
doTest(fileName);
}
@TestMetadata("extensionDelegated.kt")
public void testExtensionDelegated() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/extensionDelegated.kt");
doTest(fileName);
}
@TestMetadata("inClass.kt")
public void testInClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/inClass.kt");
doTest(fileName);
}
@TestMetadata("inlineToDelegateFor.kt")
public void testInlineToDelegateFor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/inlineToDelegateFor.kt");
doTest(fileName);
}
@TestMetadata("jvmStaticInObject.kt")
public void testJvmStaticInObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/jvmStaticInObject.kt");
doTest(fileName);
}
@TestMetadata("memberExtension.kt")
public void testMemberExtension() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/memberExtension.kt");
doTest(fileName);
}
}
}
@@ -6001,11 +6001,41 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/toDelegateFor"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("evaluationOrder.kt")
public void testEvaluationOrder() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/evaluationOrder.kt");
doTest(fileName);
}
@TestMetadata("extensionDelegated.kt")
public void testExtensionDelegated() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/extensionDelegated.kt");
doTest(fileName);
}
@TestMetadata("inClass.kt")
public void testInClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/inClass.kt");
doTest(fileName);
}
@TestMetadata("inlineToDelegateFor.kt")
public void testInlineToDelegateFor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/inlineToDelegateFor.kt");
doTest(fileName);
}
@TestMetadata("jvmStaticInObject.kt")
public void testJvmStaticInObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/jvmStaticInObject.kt");
doTest(fileName);
}
@TestMetadata("memberExtension.kt")
public void testMemberExtension() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/memberExtension.kt");
doTest(fileName);
}
}
}
@@ -6001,11 +6001,41 @@ public class LightAnalysisModeCodegenTestGenerated extends AbstractLightAnalysis
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/toDelegateFor"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("evaluationOrder.kt")
public void testEvaluationOrder() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/evaluationOrder.kt");
doTest(fileName);
}
@TestMetadata("extensionDelegated.kt")
public void testExtensionDelegated() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/extensionDelegated.kt");
doTest(fileName);
}
@TestMetadata("inClass.kt")
public void testInClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/inClass.kt");
doTest(fileName);
}
@TestMetadata("inlineToDelegateFor.kt")
public void testInlineToDelegateFor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/inlineToDelegateFor.kt");
doTest(fileName);
}
@TestMetadata("jvmStaticInObject.kt")
public void testJvmStaticInObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/jvmStaticInObject.kt");
doTest(fileName);
}
@TestMetadata("memberExtension.kt")
public void testMemberExtension() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/memberExtension.kt");
doTest(fileName);
}
}
}
@@ -6896,11 +6896,71 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/toDelegateFor"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("evaluationOrder.kt")
public void testEvaluationOrder() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/evaluationOrder.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("extensionDelegated.kt")
public void testExtensionDelegated() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/extensionDelegated.kt");
doTest(fileName);
}
@TestMetadata("inClass.kt")
public void testInClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/inClass.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("inlineToDelegateFor.kt")
public void testInlineToDelegateFor() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/inlineToDelegateFor.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("jvmStaticInObject.kt")
public void testJvmStaticInObject() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/jvmStaticInObject.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
@TestMetadata("memberExtension.kt")
public void testMemberExtension() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/toDelegateFor/memberExtension.kt");
try {
doTest(fileName);
}
catch (Throwable ignore) {
return;
}
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
}
}
}