[FIR2IR] Use companion as bound receiver if expected type requires it
A::foo is preferably resolved as an unbound reference to A.foo, however if A.Companion is a subtype of A and the expected type has one fewer parameter than the type of the unbound reference, generate a bound reference with the companion as receiver. ^KT-56519 Fixed
This commit is contained in:
committed by
Space Team
parent
fc96eb6d8d
commit
1f0e6321b0
+6
@@ -2354,6 +2354,12 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/callableReference/bound/companionObjectReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("companionObjectReceiverInheritsFromOuter.kt")
|
||||
public void testCompanionObjectReceiverInheritsFromOuter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/bound/companionObjectReceiverInheritsFromOuter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dontShareReceiver.kt")
|
||||
public void testDontShareReceiver() throws Exception {
|
||||
|
||||
+6
@@ -2408,6 +2408,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/callableReference/bound/companionObjectReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("companionObjectReceiverInheritsFromOuter.kt")
|
||||
public void testCompanionObjectReceiverInheritsFromOuter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/bound/companionObjectReceiverInheritsFromOuter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dontShareReceiver.kt")
|
||||
public void testDontShareReceiver() throws Exception {
|
||||
|
||||
+6
@@ -2408,6 +2408,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/callableReference/bound/companionObjectReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("companionObjectReceiverInheritsFromOuter.kt")
|
||||
public void testCompanionObjectReceiverInheritsFromOuter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/bound/companionObjectReceiverInheritsFromOuter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dontShareReceiver.kt")
|
||||
public void testDontShareReceiver() throws Exception {
|
||||
|
||||
+6
@@ -2408,6 +2408,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
||||
runTest("compiler/testData/codegen/box/callableReference/bound/companionObjectReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("companionObjectReceiverInheritsFromOuter.kt")
|
||||
public void testCompanionObjectReceiverInheritsFromOuter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/callableReference/bound/companionObjectReceiverInheritsFromOuter.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("dontShareReceiver.kt")
|
||||
public void testDontShareReceiver() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user