From 7c67a3315ab44c4cea9b99c62649711372d2f9ab Mon Sep 17 00:00:00 2001 From: Mikhael Bogdanov Date: Tue, 21 Jun 2016 15:54:51 +0300 Subject: [PATCH] Temporary throw exception on unsupported increment and augment assignment on local delegated properties and inline properties --- .../jetbrains/kotlin/codegen/StackValue.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java index 4d9f730e670..aa75556fe0f 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/StackValue.java @@ -44,6 +44,7 @@ import org.jetbrains.kotlin.resolve.calls.model.DefaultValueArgument; import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument; import org.jetbrains.kotlin.resolve.constants.ConstantValue; +import org.jetbrains.kotlin.resolve.inline.InlineUtil; import org.jetbrains.kotlin.resolve.jvm.AsmTypes; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature; @@ -1783,6 +1784,20 @@ public abstract class StackValue { } private static StackValue complexReceiver(StackValue stackValue, boolean... isReadOperations) { + if (stackValue instanceof Property) { + ResolvedCall resolvedCall = ((Property) stackValue).resolvedCall; + if (resolvedCall != null && + resolvedCall.getResultingDescriptor() instanceof PropertyDescriptor && + InlineUtil.hasInlineAccessors((PropertyDescriptor) resolvedCall.getResultingDescriptor())) { + //TODO need to support + throwUnsupportedComplexOperation(resolvedCall.getResultingDescriptor()); + } + } + else if (stackValue instanceof Delegate) { + //TODO need to support + throwUnsupportedComplexOperation(((Delegate) stackValue).variableDescriptor); + } + if (stackValue instanceof StackValueWithSimpleReceiver) { return new DelegatedForComplexReceiver(stackValue.type, (StackValueWithSimpleReceiver) stackValue, new ComplexReceiver((StackValueWithSimpleReceiver) stackValue, isReadOperations)); @@ -1854,5 +1869,13 @@ public abstract class StackValue { v.mark(end); } } + + private static void throwUnsupportedComplexOperation( + @NotNull CallableDescriptor descriptor + ) { + throw new RuntimeException( + "Augment assignment and increment are not supported for local delegated properties ans inline properties: " + + descriptor); + } }