Make TypeConstructor.isFinal return false for enums
The reason is that beforedc02b2e3aband8a0dcca957, TypeConstructor.isFinal for some class descriptors (DeserializedClassDescriptor, LazyJavaClassDescriptor, MutableClassDescriptor) were implemented as `isFinalClass` (which is `modality == FINAL && kind != ENUM_CLASS`), and all others as `modality == FINAL` or simply true/false. This led to differences in behavior depending on the exact instance of the class descriptor. Now that TypeConstructor.isFinal is always `modality == FINAL`, some tests (PseudoValueTestGenerated) fail because the finality of some type constructors changed and these tests render final vs non-final type constructors differently. In this commit, TypeConstructor.isFinal is now made to behave safer, i.e. considering enum class type constructor to be non-final (as was the case earlier for some ClassDescriptor instances). Some diagnostics might disappear (e.g. FINAL_UPPER_BOUND) but it doesn't look like a big deal
This commit is contained in:
@@ -7411,6 +7411,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compareTwoDifferentEnums.kt")
|
||||
public void testCompareTwoDifferentEnums() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/compareTwoDifferentEnums.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ConstructorCallFromOutside.kt")
|
||||
public void testConstructorCallFromOutside() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/ConstructorCallFromOutside.kt");
|
||||
|
||||
+6
@@ -7411,6 +7411,12 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("compareTwoDifferentEnums.kt")
|
||||
public void testCompareTwoDifferentEnums() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/compareTwoDifferentEnums.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("ConstructorCallFromOutside.kt")
|
||||
public void testConstructorCallFromOutside() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/ConstructorCallFromOutside.kt");
|
||||
|
||||
Reference in New Issue
Block a user