Diagnostics for incorrect enum members order, when enum entry follows enum member. A few diagnostic tests.
Now incorrect enum members order is treated as a warning.
This commit is contained in:
@@ -213,6 +213,7 @@ public interface Errors {
|
||||
DiagnosticFactory1<JetClass, ClassDescriptor> LOCAL_ENUM_NOT_ALLOWED = DiagnosticFactory1.create(ERROR, DECLARATION_NAME);
|
||||
DiagnosticFactory2<JetEnumEntry, ClassDescriptor, String> ENUM_ENTRY_USES_DEPRECATED_OR_NO_DELIMITER = DiagnosticFactory2.create(WARNING, DECLARATION_NAME);
|
||||
DiagnosticFactory1<JetEnumEntry, ClassDescriptor> ENUM_ENTRY_USES_DEPRECATED_SUPER_CONSTRUCTOR = DiagnosticFactory1.create(WARNING, DELEGATOR_SUPER_CALL);
|
||||
DiagnosticFactory1<JetEnumEntry, ClassDescriptor> ENUM_ENTRY_AFTER_ENUM_MEMBER = DiagnosticFactory1.create(WARNING, DECLARATION_NAME);
|
||||
|
||||
// Companion objects
|
||||
|
||||
|
||||
+1
@@ -259,6 +259,7 @@ public class DefaultErrorMessages {
|
||||
MAP.put(LOCAL_ENUM_NOT_ALLOWED, "Enum class ''{0}'' cannot be local", NAME);
|
||||
MAP.put(ENUM_ENTRY_USES_DEPRECATED_OR_NO_DELIMITER, "Enum entry ''{0}'' should have a correct delimiter ''{1}'' after it", NAME, STRING);
|
||||
MAP.put(ENUM_ENTRY_USES_DEPRECATED_SUPER_CONSTRUCTOR, "Enum entry ''{0}'' uses deprecated super constructor syntax, use ENTRY(arguments) instead", NAME);
|
||||
MAP.put(ENUM_ENTRY_AFTER_ENUM_MEMBER, "Enum entry ''{0}'' is not allowed after a member", NAME);
|
||||
MAP.put(DELEGATION_IN_TRAIT, "Interfaces cannot use delegation");
|
||||
MAP.put(DELEGATION_NOT_TO_TRAIT, "Only interfaces can be delegated to");
|
||||
MAP.put(UNMET_TRAIT_REQUIREMENT, "Super interface ''{0}'' requires subclasses to extend ''{1}''", NAME, NAME);
|
||||
|
||||
@@ -754,7 +754,7 @@ public class JetParsing extends AbstractJetParsing {
|
||||
parseEnumEntries();
|
||||
// TODO: syntax without SEMICOLON is deprecated, KT-7605
|
||||
consumeIf(SEMICOLON);
|
||||
parseMembers();
|
||||
parseMembers(true); // Members can include also entries, but it's deprecated syntax
|
||||
|
||||
expect(RBRACE, "Expecting '}' to close enum class body");
|
||||
myBuilder.restoreNewlinesState();
|
||||
@@ -771,30 +771,34 @@ public class JetParsing extends AbstractJetParsing {
|
||||
if (!parseEnumEntry()) {
|
||||
break;
|
||||
}
|
||||
// TODO: syntax with SEMICOLON between enum entries is deprecated, KT-7605
|
||||
if (at(SEMICOLON)) {
|
||||
// Semicolon can be legally here only if member follows
|
||||
PsiBuilder.Marker temp = mark();
|
||||
parseEnumEntryDelimiter();
|
||||
}
|
||||
}
|
||||
|
||||
private void parseEnumEntryDelimiter() {
|
||||
// TODO: syntax with SEMICOLON between enum entries is deprecated, KT-7605
|
||||
if (at(SEMICOLON)) {
|
||||
// Semicolon can be legally here only if member follows
|
||||
PsiBuilder.Marker temp = mark();
|
||||
advance(); // SEMICOLON
|
||||
ModifierDetector detector = new ModifierDetector();
|
||||
parseModifierList(detector, ONLY_ESCAPED_REGULAR_ANNOTATIONS);
|
||||
if (!atSet(SOFT_KEYWORDS_AT_MEMBER_START) && at(IDENTIFIER)) {
|
||||
// Otherwise it's old syntax that's not supported
|
||||
temp.rollbackTo();
|
||||
// Despite of the error, try to restore and parse next enum entry
|
||||
temp = mark();
|
||||
advance(); // SEMICOLON
|
||||
ModifierDetector detector = new ModifierDetector();
|
||||
parseModifierList(detector, ONLY_ESCAPED_REGULAR_ANNOTATIONS);
|
||||
if (!atSet(SOFT_KEYWORDS_AT_MEMBER_START) && at(IDENTIFIER)) {
|
||||
// Otherwise it's old syntax that's not supported
|
||||
temp.rollbackTo();
|
||||
// Despite of the error, try to restore and parse next enum entry
|
||||
temp = mark();
|
||||
advance(); // SEMICOLON
|
||||
temp.error("Expecting ','");
|
||||
}
|
||||
else {
|
||||
temp.rollbackTo();
|
||||
}
|
||||
temp.error("Expecting ','");
|
||||
}
|
||||
else {
|
||||
// TODO: syntax without COMMA is deprecated (only last entry is an exception), KT-7605
|
||||
consumeIf(COMMA);
|
||||
temp.rollbackTo();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// TODO: syntax without COMMA is deprecated (only last entry is an exception), KT-7605
|
||||
consumeIf(COMMA);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -879,11 +883,23 @@ public class JetParsing extends AbstractJetParsing {
|
||||
* ;
|
||||
*/
|
||||
private void parseMembers() {
|
||||
parseMembers(false);
|
||||
}
|
||||
|
||||
private void parseMembers(boolean deprecatedEnumEntryPossible) {
|
||||
while (!eof()) {
|
||||
if (at(RBRACE)) {
|
||||
break;
|
||||
}
|
||||
parseMemberDeclaration();
|
||||
if (deprecatedEnumEntryPossible && parseEnumEntry()) {
|
||||
// Enum entry is deprecated here
|
||||
// Error is generated later in DeclarationsChecker
|
||||
parseEnumEntryDelimiter();
|
||||
consumeIf(SEMICOLON);
|
||||
}
|
||||
else {
|
||||
parseMemberDeclaration();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -585,6 +585,16 @@ public class DeclarationsChecker {
|
||||
return !enumEntryExpectedDelimiter(enumEntry).isEmpty();
|
||||
}
|
||||
|
||||
static public boolean enumEntryAfterEnumMember(@NotNull JetEnumEntry enumEntry) {
|
||||
PsiElement previous = enumEntry.getPrevSibling();
|
||||
while (previous != null) {
|
||||
if (previous instanceof JetEnumEntry) return false;
|
||||
if (previous instanceof JetDeclaration) return true;
|
||||
previous = previous.getPrevSibling();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void checkEnumEntry(@NotNull JetEnumEntry enumEntry, @NotNull ClassDescriptor classDescriptor) {
|
||||
DeclarationDescriptor declaration = classDescriptor.getContainingDeclaration();
|
||||
assert DescriptorUtils.isEnumClass(declaration) : "Enum entry should be declared in enum class: " + classDescriptor;
|
||||
@@ -597,6 +607,9 @@ public class DeclarationsChecker {
|
||||
if (!neededDelimiter.isEmpty()) {
|
||||
trace.report(Errors.ENUM_ENTRY_USES_DEPRECATED_OR_NO_DELIMITER.on(enumEntry, classDescriptor, neededDelimiter));
|
||||
}
|
||||
if (enumEntryAfterEnumMember(enumEntry)) {
|
||||
trace.report(Errors.ENUM_ENTRY_AFTER_ENUM_MEMBER.on(enumEntry, classDescriptor));
|
||||
}
|
||||
|
||||
List<JetDelegationSpecifier> delegationSpecifiers = enumEntry.getDelegationSpecifiers();
|
||||
ConstructorDescriptor constructor = enumClass.getUnsubstitutedPrimaryConstructor();
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
enum class MixedEnum {
|
||||
companion object {
|
||||
val first = 1
|
||||
}
|
||||
fun foo(): String = "xyz"
|
||||
<!ENUM_ENTRY_USES_DEPRECATED_OR_NO_DELIMITER, ENUM_ENTRY_AFTER_ENUM_MEMBER!>ENTRY1<!>
|
||||
<!ENUM_ENTRY_USES_DEPRECATED_OR_NO_DELIMITER!>ENTRY2<!>
|
||||
ENTRY3
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package
|
||||
|
||||
internal final enum class MixedEnum : kotlin.Enum<MixedEnum> {
|
||||
public enum entry ENTRY1 : MixedEnum {
|
||||
private constructor ENTRY1()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.String
|
||||
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
|
||||
}
|
||||
|
||||
public enum entry ENTRY2 : MixedEnum {
|
||||
private constructor ENTRY2()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.String
|
||||
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
|
||||
}
|
||||
|
||||
public enum entry ENTRY3 : MixedEnum {
|
||||
private constructor ENTRY3()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.String
|
||||
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 MixedEnum()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final fun foo(): kotlin.String
|
||||
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
|
||||
|
||||
internal companion object Companion {
|
||||
private constructor Companion()
|
||||
internal final val first: kotlin.Int = 1
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): MixedEnum
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<MixedEnum>
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
enum class MixedEnum {
|
||||
<!ENUM_ENTRY_USES_DEPRECATED_OR_NO_DELIMITER!>ENTRY1<!>
|
||||
companion object {
|
||||
val first = 1
|
||||
}
|
||||
<!ENUM_ENTRY_USES_DEPRECATED_OR_NO_DELIMITER, ENUM_ENTRY_AFTER_ENUM_MEMBER!>ENTRY2<!>
|
||||
fun foo(): String = "xyz"
|
||||
<!ENUM_ENTRY_AFTER_ENUM_MEMBER!>ENTRY3<!>
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package
|
||||
|
||||
internal final enum class MixedEnum : kotlin.Enum<MixedEnum> {
|
||||
public enum entry ENTRY1 : MixedEnum {
|
||||
private constructor ENTRY1()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.String
|
||||
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
|
||||
}
|
||||
|
||||
public enum entry ENTRY2 : MixedEnum {
|
||||
private constructor ENTRY2()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.String
|
||||
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
|
||||
}
|
||||
|
||||
public enum entry ENTRY3 : MixedEnum {
|
||||
private constructor ENTRY3()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.String
|
||||
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 MixedEnum()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final fun foo(): kotlin.String
|
||||
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
|
||||
|
||||
internal companion object Companion {
|
||||
private constructor Companion()
|
||||
internal final val first: kotlin.Int = 1
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): MixedEnum
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<MixedEnum>
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
enum class MixedEnum {
|
||||
<!ENUM_ENTRY_USES_DEPRECATED_OR_NO_DELIMITER!>ENTRY1<!>,
|
||||
companion object {
|
||||
val first = 1
|
||||
}
|
||||
<!ENUM_ENTRY_USES_DEPRECATED_OR_NO_DELIMITER, ENUM_ENTRY_AFTER_ENUM_MEMBER!>ENTRY2<!>,
|
||||
fun foo(): String = "xyz"
|
||||
<!ENUM_ENTRY_AFTER_ENUM_MEMBER!>ENTRY3<!>
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package
|
||||
|
||||
internal final enum class MixedEnum : kotlin.Enum<MixedEnum> {
|
||||
public enum entry ENTRY1 : MixedEnum {
|
||||
private constructor ENTRY1()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.String
|
||||
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
|
||||
}
|
||||
|
||||
public enum entry ENTRY2 : MixedEnum {
|
||||
private constructor ENTRY2()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.String
|
||||
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
|
||||
}
|
||||
|
||||
public enum entry ENTRY3 : MixedEnum {
|
||||
private constructor ENTRY3()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.String
|
||||
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 MixedEnum()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final fun foo(): kotlin.String
|
||||
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
|
||||
|
||||
internal companion object Companion {
|
||||
private constructor Companion()
|
||||
internal final val first: kotlin.Int = 1
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): MixedEnum
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<MixedEnum>
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
enum class MixedEnum {
|
||||
ENTRY1;
|
||||
companion object {
|
||||
val first = 1
|
||||
}
|
||||
<!ENUM_ENTRY_AFTER_ENUM_MEMBER!>ENTRY2<!>;
|
||||
fun foo(): String = "xyz"
|
||||
<!ENUM_ENTRY_AFTER_ENUM_MEMBER!>ENTRY3<!>
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package
|
||||
|
||||
internal final enum class MixedEnum : kotlin.Enum<MixedEnum> {
|
||||
public enum entry ENTRY1 : MixedEnum {
|
||||
private constructor ENTRY1()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.String
|
||||
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
|
||||
}
|
||||
|
||||
public enum entry ENTRY2 : MixedEnum {
|
||||
private constructor ENTRY2()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.String
|
||||
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
|
||||
}
|
||||
|
||||
public enum entry ENTRY3 : MixedEnum {
|
||||
private constructor ENTRY3()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.String
|
||||
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 MixedEnum()
|
||||
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: MixedEnum): kotlin.Int
|
||||
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final fun foo(): kotlin.String
|
||||
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
|
||||
|
||||
internal companion object Companion {
|
||||
private constructor Companion()
|
||||
internal final val first: kotlin.Int = 1
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
// Static members
|
||||
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): MixedEnum
|
||||
public final /*synthesized*/ fun values(): kotlin.Array<MixedEnum>
|
||||
}
|
||||
@@ -30,15 +30,10 @@ JetFile: EnumSemicolonBetweenWithMembers.kt
|
||||
INTEGER_CONSTANT
|
||||
PsiElement(INTEGER_LITERAL)('1')
|
||||
PsiWhiteSpace('\n ')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('SOUTH')
|
||||
PsiErrorElement:Expecting member declaration
|
||||
PsiElement(SEMICOLON)(';')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('SOUTH')
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiWhiteSpace('\n ')
|
||||
OBJECT_DECLARATION
|
||||
MODIFIER_LIST
|
||||
@@ -64,24 +59,14 @@ JetFile: EnumSemicolonBetweenWithMembers.kt
|
||||
PsiWhiteSpace('\n ')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n ')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('WEST')
|
||||
PsiErrorElement:Expecting member declaration
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('WEST')
|
||||
PsiErrorElement:Expecting ','
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiWhiteSpace('\n ')
|
||||
MODIFIER_LIST
|
||||
ANNOTATION_ENTRY
|
||||
CONSTRUCTOR_CALLEE
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('EAST')
|
||||
PsiErrorElement:Expecting member declaration
|
||||
<empty list>
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('EAST')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
@@ -4188,6 +4188,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumEntriesAtTheEnd.kt")
|
||||
public void testEnumEntriesAtTheEnd() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumEntriesAtTheEnd.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumEntryCannotHaveClassObject.kt")
|
||||
public void testEnumEntryCannotHaveClassObject() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumEntryCannotHaveClassObject.kt");
|
||||
@@ -4230,6 +4236,24 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumMixed.kt")
|
||||
public void testEnumMixed() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumMixed.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumMixedWithCommas.kt")
|
||||
public void testEnumMixedWithCommas() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumMixedWithCommas.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumMixedWithSemicolons.kt")
|
||||
public void testEnumMixedWithSemicolons() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumMixedWithSemicolons.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("enumModifier.kt")
|
||||
public void testEnumModifier() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumModifier.kt");
|
||||
|
||||
Reference in New Issue
Block a user