FIR: consider enum class overridden members non-final #KT-48164 Fixed
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
FILE: EnumWithToString.kt
|
||||
public final enum class Some : R|kotlin/Enum<Some>| {
|
||||
private constructor(): R|Some| {
|
||||
super<R|kotlin/Enum<Some>|>()
|
||||
}
|
||||
|
||||
public final static enum entry ENTRY: R|Some| = object : R|Some| {
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|Some|>()
|
||||
}
|
||||
|
||||
public final override fun toString(): R|kotlin/String| {
|
||||
^toString String(Entry)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public open override fun toString(): R|kotlin/String| {
|
||||
^toString String(Some)
|
||||
}
|
||||
|
||||
public final static fun values(): R|kotlin/Array<Some>| {
|
||||
}
|
||||
|
||||
public final static fun valueOf(value: R|kotlin/String|): R|Some| {
|
||||
}
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
enum class Some {
|
||||
ENTRY {
|
||||
override fun toString(): String = "Entry"
|
||||
};
|
||||
|
||||
override fun toString(): String = "Some"
|
||||
}
|
||||
+6
@@ -5038,6 +5038,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
||||
public void testDailyAggregatedDoubleFactor() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/DailyAggregatedDoubleFactor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumWithToString.kt")
|
||||
public void testEnumWithToString() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/EnumWithToString.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+6
@@ -5038,6 +5038,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
public void testDailyAggregatedDoubleFactor() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/DailyAggregatedDoubleFactor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumWithToString.kt")
|
||||
public void testEnumWithToString() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/EnumWithToString.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
+7
-1
@@ -258,7 +258,13 @@ class FirStatusResolver(
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
if (declaration.isOverride && containingClass.modality != Modality.FINAL) Modality.OPEN else Modality.FINAL
|
||||
if (declaration.isOverride &&
|
||||
(containingClass.modality != Modality.FINAL || containingClass.classKind == ClassKind.ENUM_CLASS)
|
||||
) {
|
||||
Modality.OPEN
|
||||
} else {
|
||||
Modality.FINAL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
@@ -5038,6 +5038,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
||||
public void testDailyAggregatedDoubleFactor() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/DailyAggregatedDoubleFactor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("EnumWithToString.kt")
|
||||
public void testEnumWithToString() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/intellij/EnumWithToString.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
|
||||
Reference in New Issue
Block a user