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
@@ -13635,6 +13635,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, 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 {
@@ -13647,6 +13659,18 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
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 {
@@ -13731,6 +13731,18 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, 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 {
@@ -13743,6 +13755,18 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
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 {
@@ -13731,6 +13731,18 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, 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 {
@@ -13743,6 +13755,18 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
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 {
@@ -13731,6 +13731,18 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/fir"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, 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 {
@@ -13743,6 +13755,18 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
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 {