Fir2Ir: do not skip building static fake overrides for enums
Fake overrides are needed at least for static fields inherited from Java interfaces. Not static methods though, because they are not inherited. #KT-57302 Fixed
This commit is contained in:
committed by
Space Team
parent
c046bedfc2
commit
1bc299508a
-1
@@ -94,7 +94,6 @@ class FakeOverrideGenerator(
|
||||
)
|
||||
}
|
||||
}
|
||||
if (firClass.isEnumClass) return@buildList // F/O for values/valueOf/entries aren't needed, for other members aren't possible
|
||||
val staticScope = firClass.scopeProvider.getStaticMemberScopeForCallables(firClass, session, scopeSession)
|
||||
if (staticScope != null) {
|
||||
generateFakeOverridesForName(
|
||||
|
||||
+6
@@ -49303,6 +49303,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/statics/anonymousInitializerInClassObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enumWithInheritedStaticField.kt")
|
||||
public void testEnumWithInheritedStaticField() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/statics/enumWithInheritedStaticField.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fields.kt")
|
||||
public void testFields() throws Exception {
|
||||
|
||||
+6
@@ -49303,6 +49303,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/statics/anonymousInitializerInClassObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enumWithInheritedStaticField.kt")
|
||||
public void testEnumWithInheritedStaticField() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/statics/enumWithInheritedStaticField.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fields.kt")
|
||||
public void testFields() throws Exception {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_LIGHT_ANALYSIS
|
||||
// FILE: E.java
|
||||
|
||||
interface I {
|
||||
String result = "OK";
|
||||
}
|
||||
|
||||
public enum E implements I {}
|
||||
|
||||
// FILE: box.kt
|
||||
|
||||
fun box(): String = E.result
|
||||
+6
@@ -46879,6 +46879,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
runTest("compiler/testData/codegen/box/statics/anonymousInitializerInClassObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enumWithInheritedStaticField.kt")
|
||||
public void testEnumWithInheritedStaticField() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/statics/enumWithInheritedStaticField.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fields.kt")
|
||||
public void testFields() throws Exception {
|
||||
|
||||
+6
@@ -49303,6 +49303,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/statics/anonymousInitializerInClassObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enumWithInheritedStaticField.kt")
|
||||
public void testEnumWithInheritedStaticField() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/statics/enumWithInheritedStaticField.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fields.kt")
|
||||
public void testFields() throws Exception {
|
||||
|
||||
+6
@@ -49303,6 +49303,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/statics/anonymousInitializerInClassObject.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("enumWithInheritedStaticField.kt")
|
||||
public void testEnumWithInheritedStaticField() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/statics/enumWithInheritedStaticField.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fields.kt")
|
||||
public void testFields() throws Exception {
|
||||
|
||||
+5
@@ -37969,6 +37969,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/statics/anonymousInitializerInClassObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("enumWithInheritedStaticField.kt")
|
||||
public void testEnumWithInheritedStaticField() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/statics/enumWithInheritedStaticField.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("fields.kt")
|
||||
public void testFields() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/statics/fields.kt");
|
||||
|
||||
Reference in New Issue
Block a user