Fix for KT-15437: VerifyError: Bad local variable type on simplest provideDelegate
#KT-15437 Fixed
This commit is contained in:
@@ -493,11 +493,6 @@ public abstract class MemberCodegen<T extends KtPureElement/* TODO: & KtDeclarat
|
|||||||
|
|
||||||
int indexOfDelegatedProperty = PropertyCodegen.indexOfDelegatedProperty(property);
|
int indexOfDelegatedProperty = PropertyCodegen.indexOfDelegatedProperty(property);
|
||||||
|
|
||||||
List<? extends ValueArgument> arguments = provideDelegateResolvedCall.getCall().getValueArguments();
|
|
||||||
assert arguments.size() == 2 :
|
|
||||||
"Resolved call for '" + OperatorNameConventions.PROVIDE_DELEGATE.asString() + "' should have exactly 2 value parameters";
|
|
||||||
codegen.tempVariables.put(arguments.get(0).asElement(), StackValue.LOCAL_0);
|
|
||||||
|
|
||||||
StackValue delegateValue = PropertyCodegen.invokeDelegatedPropertyConventionMethodWithReceiver(
|
StackValue delegateValue = PropertyCodegen.invokeDelegatedPropertyConventionMethodWithReceiver(
|
||||||
codegen, typeMapper, provideDelegateResolvedCall, indexOfDelegatedProperty, 1, provideDelegateReceiver);
|
codegen, typeMapper, provideDelegateResolvedCall, indexOfDelegatedProperty, 1, provideDelegateReceiver);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
|
class Delegate(val value: String) {
|
||||||
|
operator fun provideDelegate(instance: A, property: KProperty<*>): Delegate = Delegate(instance.value)
|
||||||
|
operator fun getValue(instance: Any?, property: KProperty<*>) = value
|
||||||
|
}
|
||||||
|
|
||||||
|
class A(val value: String) {
|
||||||
|
val result: String by Delegate("Fail")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return A("OK").result
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import kotlin.reflect.KProperty
|
||||||
|
|
||||||
|
class Delegate {
|
||||||
|
operator fun provideDelegate(instance: Any?, property: KProperty<*>): Delegate = this
|
||||||
|
operator fun getValue(instance: Any?, property: KProperty<*>) = "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
val result: String by Delegate()
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return result
|
||||||
|
}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
public final class A {
|
||||||
|
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||||
|
private final @org.jetbrains.annotations.NotNull field result$delegate: Delegate
|
||||||
|
private final @org.jetbrains.annotations.NotNull field value: java.lang.String
|
||||||
|
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||||
|
public final @org.jetbrains.annotations.NotNull method getResult(): java.lang.String
|
||||||
|
public final @org.jetbrains.annotations.NotNull method getValue(): java.lang.String
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class Delegate {
|
||||||
|
private final @org.jetbrains.annotations.NotNull field value: java.lang.String
|
||||||
|
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||||
|
public final @org.jetbrains.annotations.NotNull method getValue(): java.lang.String
|
||||||
|
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||||
|
public final @org.jetbrains.annotations.NotNull method provideDelegate(@org.jetbrains.annotations.NotNull p0: A, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): Delegate
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class HostCheckKt {
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
public final class Delegate {
|
||||||
|
public method <init>(): void
|
||||||
|
public final @org.jetbrains.annotations.NotNull method getValue(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): java.lang.String
|
||||||
|
public final @org.jetbrains.annotations.NotNull method provideDelegate(@org.jetbrains.annotations.Nullable p0: java.lang.Object, @org.jetbrains.annotations.NotNull p1: kotlin.reflect.KProperty): Delegate
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class Kt15437Kt {
|
||||||
|
private synthetic final static field $$delegatedProperties: kotlin.reflect.KProperty[]
|
||||||
|
private final static @org.jetbrains.annotations.NotNull field result$delegate: Delegate
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||||
|
public final static @org.jetbrains.annotations.NotNull method getResult(): java.lang.String
|
||||||
|
}
|
||||||
+12
@@ -6115,6 +6115,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("hostCheck.kt")
|
||||||
|
public void testHostCheck() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/hostCheck.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inClass.kt")
|
@TestMetadata("inClass.kt")
|
||||||
public void testInClass() throws Exception {
|
public void testInClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/inClass.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/inClass.kt");
|
||||||
@@ -6133,6 +6139,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt15437.kt")
|
||||||
|
public void testKt15437() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/kt15437.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("local.kt")
|
@TestMetadata("local.kt")
|
||||||
public void testLocal() throws Exception {
|
public void testLocal() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/local.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/local.kt");
|
||||||
|
|||||||
@@ -6115,6 +6115,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("hostCheck.kt")
|
||||||
|
public void testHostCheck() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/hostCheck.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inClass.kt")
|
@TestMetadata("inClass.kt")
|
||||||
public void testInClass() throws Exception {
|
public void testInClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/inClass.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/inClass.kt");
|
||||||
@@ -6133,6 +6139,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt15437.kt")
|
||||||
|
public void testKt15437() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/kt15437.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("local.kt")
|
@TestMetadata("local.kt")
|
||||||
public void testLocal() throws Exception {
|
public void testLocal() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/local.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/local.kt");
|
||||||
|
|||||||
+12
@@ -6115,6 +6115,12 @@ public class LightAnalysisModeCodegenTestGenerated extends AbstractLightAnalysis
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("hostCheck.kt")
|
||||||
|
public void testHostCheck() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/hostCheck.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inClass.kt")
|
@TestMetadata("inClass.kt")
|
||||||
public void testInClass() throws Exception {
|
public void testInClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/inClass.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/inClass.kt");
|
||||||
@@ -6133,6 +6139,12 @@ public class LightAnalysisModeCodegenTestGenerated extends AbstractLightAnalysis
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt15437.kt")
|
||||||
|
public void testKt15437() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/kt15437.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("local.kt")
|
@TestMetadata("local.kt")
|
||||||
public void testLocal() throws Exception {
|
public void testLocal() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/local.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/local.kt");
|
||||||
|
|||||||
+12
@@ -7016,6 +7016,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("hostCheck.kt")
|
||||||
|
public void testHostCheck() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/hostCheck.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inClass.kt")
|
@TestMetadata("inClass.kt")
|
||||||
public void testInClass() throws Exception {
|
public void testInClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/inClass.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/inClass.kt");
|
||||||
@@ -7040,6 +7046,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt15437.kt")
|
||||||
|
public void testKt15437() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/kt15437.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("local.kt")
|
@TestMetadata("local.kt")
|
||||||
public void testLocal() throws Exception {
|
public void testLocal() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/local.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate/local.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user