K2: add explicit cast to Any for Any function calls on stub types
This commit solves a stub type inconsistency problem.
As a part of KT-59369 fix we decided (see commit 299d2799),
that ConeStubTypeForChainInference has a scope of Any,
so we can safely resolve only to equals/hashCode/toString.
However, later we can replace a stub type with some inferred type,
which can have its own equals/hashCode/toString implementation,
while the call still refers Any member.
In this situation FIR2IR decides that we are calling a fake override,
which is not true, in fact we are calling an overriding method.
This leads to a crash in Native backend.
To solve this situation, we provide an explicit cast of a dispatch
receiver with a stub type (ConeStubTypeForChainInference) to Any,
thus confirming directly we are calling Any method and nothing else.
#KT-63932 Fixed
This commit is contained in:
committed by
Space Team
parent
a0deaea8fe
commit
dbca7358af
+12
@@ -43265,6 +43265,18 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/simpleGenerator.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("stubCallOnReceiver.kt")
|
||||
public void testStubCallOnReceiver() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/stubCallOnReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("stubCallOnVariable.kt")
|
||||
public void testStubCallOnVariable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/stubCallOnVariable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendCallsWithErrors.kt")
|
||||
public void testSuspendCallsWithErrors() throws Exception {
|
||||
|
||||
+12
@@ -43265,6 +43265,18 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/simpleGenerator.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("stubCallOnReceiver.kt")
|
||||
public void testStubCallOnReceiver() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/stubCallOnReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("stubCallOnVariable.kt")
|
||||
public void testStubCallOnVariable() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/stubCallOnVariable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("suspendCallsWithErrors.kt")
|
||||
public void testSuspendCallsWithErrors() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user