FIR2IR: Fix IAE for case of local override of a method with defaults

It was happening because for MyClass.foo we didn't set overriddenSymbols
properly because in ClassMemberGenerator.convertFunctionContent we
used incorrect containingFirClass that was pointing to anonymous class
instead of MyClass.

^KT-58902 Fixed
This commit is contained in:
Denis.Zharkov
2023-06-07 13:54:40 +02:00
committed by Space Team
parent b04848d179
commit c474c54903
21 changed files with 422 additions and 2 deletions
@@ -14906,6 +14906,18 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("anonymousOverrideWithDefaultInLocalOverridden.kt")
public void testAnonymousOverrideWithDefaultInLocalOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/anonymousOverrideWithDefaultInLocalOverridden.kt");
}
@Test
@TestMetadata("anonymousOverrideWithDefaultInOverridden.kt")
public void testAnonymousOverrideWithDefaultInOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/anonymousOverrideWithDefaultInOverridden.kt");
}
@Test
@TestMetadata("classCanNotBeCastedToVoid.kt")
public void testClassCanNotBeCastedToVoid() throws Exception {
@@ -14918,6 +14930,18 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt");
}
@Test
@TestMetadata("localOverrideWithDefaultInLocalOverridden.kt")
public void testLocalOverrideWithDefaultInLocalOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/localOverrideWithDefaultInLocalOverridden.kt");
}
@Test
@TestMetadata("localOverrideWithDefaultInOverridden.kt")
public void testLocalOverrideWithDefaultInOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/localOverrideWithDefaultInOverridden.kt");
}
@Test
@TestMetadata("nestedClassTypeParameterDeserialization.kt")
public void testNestedClassTypeParameterDeserialization() throws Exception {
@@ -15256,6 +15256,18 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("anonymousOverrideWithDefaultInLocalOverridden.kt")
public void testAnonymousOverrideWithDefaultInLocalOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/anonymousOverrideWithDefaultInLocalOverridden.kt");
}
@Test
@TestMetadata("anonymousOverrideWithDefaultInOverridden.kt")
public void testAnonymousOverrideWithDefaultInOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/anonymousOverrideWithDefaultInOverridden.kt");
}
@Test
@TestMetadata("classCanNotBeCastedToVoid.kt")
public void testClassCanNotBeCastedToVoid() throws Exception {
@@ -15268,6 +15280,18 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt");
}
@Test
@TestMetadata("localOverrideWithDefaultInLocalOverridden.kt")
public void testLocalOverrideWithDefaultInLocalOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/localOverrideWithDefaultInLocalOverridden.kt");
}
@Test
@TestMetadata("localOverrideWithDefaultInOverridden.kt")
public void testLocalOverrideWithDefaultInOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/localOverrideWithDefaultInOverridden.kt");
}
@Test
@TestMetadata("nestedClassTypeParameterDeserialization.kt")
public void testNestedClassTypeParameterDeserialization() throws Exception {
@@ -14732,6 +14732,18 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("anonymousOverrideWithDefaultInLocalOverridden.kt")
public void testAnonymousOverrideWithDefaultInLocalOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/anonymousOverrideWithDefaultInLocalOverridden.kt");
}
@Test
@TestMetadata("anonymousOverrideWithDefaultInOverridden.kt")
public void testAnonymousOverrideWithDefaultInOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/anonymousOverrideWithDefaultInOverridden.kt");
}
@Test
@TestMetadata("classCanNotBeCastedToVoid.kt")
public void testClassCanNotBeCastedToVoid() throws Exception {
@@ -14744,6 +14756,18 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt");
}
@Test
@TestMetadata("localOverrideWithDefaultInLocalOverridden.kt")
public void testLocalOverrideWithDefaultInLocalOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/localOverrideWithDefaultInLocalOverridden.kt");
}
@Test
@TestMetadata("localOverrideWithDefaultInOverridden.kt")
public void testLocalOverrideWithDefaultInOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/localOverrideWithDefaultInOverridden.kt");
}
@Test
@TestMetadata("nestedClassTypeParameterDeserialization.kt")
public void testNestedClassTypeParameterDeserialization() throws Exception {
@@ -14907,6 +14907,18 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("anonymousOverrideWithDefaultInLocalOverridden.kt")
public void testAnonymousOverrideWithDefaultInLocalOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/anonymousOverrideWithDefaultInLocalOverridden.kt");
}
@Test
@TestMetadata("anonymousOverrideWithDefaultInOverridden.kt")
public void testAnonymousOverrideWithDefaultInOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/anonymousOverrideWithDefaultInOverridden.kt");
}
@Test
@TestMetadata("classCanNotBeCastedToVoid.kt")
public void testClassCanNotBeCastedToVoid() throws Exception {
@@ -14919,6 +14931,18 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
runTest("compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt");
}
@Test
@TestMetadata("localOverrideWithDefaultInLocalOverridden.kt")
public void testLocalOverrideWithDefaultInLocalOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/localOverrideWithDefaultInLocalOverridden.kt");
}
@Test
@TestMetadata("localOverrideWithDefaultInOverridden.kt")
public void testLocalOverrideWithDefaultInOverridden() throws Exception {
runTest("compiler/testData/codegen/box/fir/localOverrideWithDefaultInOverridden.kt");
}
@Test
@TestMetadata("nestedClassTypeParameterDeserialization.kt")
public void testNestedClassTypeParameterDeserialization() throws Exception {