FIR: consider enum class overridden members non-final #KT-48164 Fixed

This commit is contained in:
Mikhail Glukhikh
2021-08-09 13:13:16 +03:00
parent 8e32bbbe90
commit 2e2edf398c
6 changed files with 60 additions and 1 deletions
@@ -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| {
}
}
@@ -0,0 +1,7 @@
enum class Some {
ENTRY {
override fun toString(): String = "Entry"
};
override fun toString(): String = "Some"
}
@@ -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
@@ -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
@@ -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
}
}
}
}
@@ -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