More accurate check on an enum entry deprecated super constructor #EA-69735 Fixed

This commit is contained in:
Mikhail Glukhikh
2015-06-19 13:38:49 +03:00
parent d0897193e8
commit 065db07e1c
4 changed files with 37 additions and 1 deletions
@@ -558,7 +558,7 @@ public class DeclarationsChecker {
// ENTRY(arguments)
public static boolean enumEntryUsesDeprecatedSuperConstructor(@NotNull JetEnumEntry enumEntry) {
JetInitializerList initializerList = enumEntry.getInitializerList();
if (initializerList == null) return false;
if (initializerList == null || initializerList.getInitializers().isEmpty()) return false;
JetTypeReference typeReference = initializerList.getInitializers().get(0).getTypeReference();
if (typeReference == null) return false;
JetUserType userType = (JetUserType) typeReference.getTypeElement();
@@ -0,0 +1,5 @@
enum class MyEnum {
// Here we have a problem
// while checking on a deprecated super constructor
FIRST:
<!SYNTAX!><!>}
@@ -0,0 +1,25 @@
package
internal final enum class MyEnum : kotlin.Enum<MyEnum> {
public enum entry FIRST : MyEnum {
private constructor FIRST()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MyEnum): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
private constructor MyEnum()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MyEnum): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): MyEnum
public final /*synthesized*/ fun values(): kotlin.Array<MyEnum>
}
@@ -10248,6 +10248,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("ea69735.kt")
public void testEa69735() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/ea69735.kt");
doTest(fileName);
}
@TestMetadata("ErrorsOnIbjectExpressionsAsParameters.kt")
public void testErrorsOnIbjectExpressionsAsParameters() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/ErrorsOnIbjectExpressionsAsParameters.kt");