Fix VerifyError on bound function reference on generic property
Also add a test for obsolete KT-14755 #KT-16929 Fixed
This commit is contained in:
@@ -3365,7 +3365,8 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
|
||||
KotlinType receiverExpressionType = expressionJetType(expression.getReceiverExpression());
|
||||
Type receiverAsmType = receiverExpressionType != null ? asmType(receiverExpressionType) : null;
|
||||
StackValue receiverValue = receiverExpressionType != null ? gen(expression.getReceiverExpression()) : null;
|
||||
StackValue receiverValue =
|
||||
receiverExpressionType != null ? StackValue.coercion(gen(expression.getReceiverExpression()), receiverAsmType) : null;
|
||||
|
||||
FunctionDescriptor functionDescriptor = bindingContext.get(FUNCTION, expression);
|
||||
if (functionDescriptor != null) {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
class Generic<P : Any>(val p: P)
|
||||
|
||||
class Host {
|
||||
fun t() {}
|
||||
val v = "OK"
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
Generic(Host()).p::class
|
||||
(Generic(Host()).p::t)()
|
||||
return (Generic(Host()).p::v)()
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
class B
|
||||
|
||||
fun B.magic() {
|
||||
}
|
||||
|
||||
fun boom(a: Any) {
|
||||
when (a) {
|
||||
is B -> run(a::magic)
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
boom(B())
|
||||
return "OK"
|
||||
}
|
||||
+12
@@ -1573,6 +1573,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("genericValOnLHS.kt")
|
||||
public void testGenericValOnLHS() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/genericValOnLHS.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kCallableNameIntrinsic.kt")
|
||||
public void testKCallableNameIntrinsic() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/kCallableNameIntrinsic.kt");
|
||||
@@ -1627,6 +1633,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("smartCastForExtensionReceiver.kt")
|
||||
public void testSmartCastForExtensionReceiver() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/smartCastForExtensionReceiver.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("syntheticExtensionOnLHS.kt")
|
||||
public void testSyntheticExtensionOnLHS() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/syntheticExtensionOnLHS.kt");
|
||||
|
||||
@@ -1573,6 +1573,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("genericValOnLHS.kt")
|
||||
public void testGenericValOnLHS() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/genericValOnLHS.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kCallableNameIntrinsic.kt")
|
||||
public void testKCallableNameIntrinsic() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/kCallableNameIntrinsic.kt");
|
||||
@@ -1627,6 +1633,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("smartCastForExtensionReceiver.kt")
|
||||
public void testSmartCastForExtensionReceiver() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/smartCastForExtensionReceiver.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("syntheticExtensionOnLHS.kt")
|
||||
public void testSyntheticExtensionOnLHS() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/syntheticExtensionOnLHS.kt");
|
||||
|
||||
@@ -1573,6 +1573,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("genericValOnLHS.kt")
|
||||
public void testGenericValOnLHS() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/genericValOnLHS.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kCallableNameIntrinsic.kt")
|
||||
public void testKCallableNameIntrinsic() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/kCallableNameIntrinsic.kt");
|
||||
@@ -1627,6 +1633,12 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("smartCastForExtensionReceiver.kt")
|
||||
public void testSmartCastForExtensionReceiver() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/smartCastForExtensionReceiver.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("syntheticExtensionOnLHS.kt")
|
||||
public void testSyntheticExtensionOnLHS() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/syntheticExtensionOnLHS.kt");
|
||||
|
||||
+12
@@ -1892,6 +1892,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that.");
|
||||
}
|
||||
|
||||
@TestMetadata("genericValOnLHS.kt")
|
||||
public void testGenericValOnLHS() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/genericValOnLHS.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("kCallableNameIntrinsic.kt")
|
||||
public void testKCallableNameIntrinsic() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/kCallableNameIntrinsic.kt");
|
||||
@@ -1946,6 +1952,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("smartCastForExtensionReceiver.kt")
|
||||
public void testSmartCastForExtensionReceiver() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/callableReference/bound/smartCastForExtensionReceiver.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/callableReference/bound/equals")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user