diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index 339452f6775..c749a0e082f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -211,6 +211,8 @@ public interface Errors { DiagnosticFactory1 ENUM_ENTRY_SHOULD_BE_INITIALIZED = DiagnosticFactory1.create(ERROR, DECLARATION_NAME); DiagnosticFactory1 ENUM_ENTRY_ILLEGAL_TYPE = DiagnosticFactory1.create(ERROR); DiagnosticFactory1 LOCAL_ENUM_NOT_ALLOWED = DiagnosticFactory1.create(ERROR, DECLARATION_NAME); + DiagnosticFactory2 ENUM_ENTRY_USES_DEPRECATED_OR_NO_DELIMITER = DiagnosticFactory2.create(WARNING, DECLARATION_NAME); + DiagnosticFactory1 ENUM_ENTRY_USES_DEPRECATED_SUPER_CONSTRUCTOR = DiagnosticFactory1.create(WARNING, DELEGATOR_SUPER_CALL); // Companion objects diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt index 49e7436e6cb..3840b124f5b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/PositioningStrategies.kt @@ -428,4 +428,11 @@ public object PositioningStrategies { return markElement(element.getCalleeExpression() ?: element) } } + + public val DELEGATOR_SUPER_CALL: PositioningStrategy = object: PositioningStrategy() { + override fun mark(element: JetEnumEntry): List { + val specifiers = element.getDelegationSpecifiers() + return markElement(if (specifiers.isEmpty()) element else specifiers[0]) + } + } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 73d7c3894ec..6245a7536b4 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -257,6 +257,8 @@ public class DefaultErrorMessages { MAP.put(LOCAL_OBJECT_NOT_ALLOWED, "Named object ''{0}'' is a singleton and cannot be local. Try to use anonymous object instead", NAME); 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(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); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/jetPsiUtil.kt b/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/jetPsiUtil.kt index b4a6b8d4e40..7bdc90d956f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/jetPsiUtil.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/psi/psiUtil/jetPsiUtil.kt @@ -99,6 +99,15 @@ inline public fun PsiElement.getChildrenOfType(): Array()) ?: array() } +public fun PsiElement.getNextSiblingIgnoringWhitespace(): PsiElement { + var current = this + do { + current = current.getNextSibling() + } + while (current.getNode().getElementType() == JetTokens.WHITE_SPACE) + return current +} + public fun PsiElement?.isAncestor(element: PsiElement, strict: Boolean = false): Boolean { return PsiTreeUtil.isAncestor(this, element, strict) } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java index 2ea239937fe..f0a5a90d207 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.java @@ -19,6 +19,8 @@ package org.jetbrains.kotlin.resolve; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; import com.intellij.lang.ASTNode; +import com.intellij.psi.PsiElement; +import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.descriptors.*; @@ -26,6 +28,7 @@ import org.jetbrains.kotlin.diagnostics.Errors; import org.jetbrains.kotlin.lexer.JetModifierKeywordToken; import org.jetbrains.kotlin.lexer.JetTokens; import org.jetbrains.kotlin.psi.*; +import org.jetbrains.kotlin.psi.psiUtil.PsiUtilPackage; import org.jetbrains.kotlin.types.JetType; import org.jetbrains.kotlin.types.SubstitutionUtils; import org.jetbrains.kotlin.types.TypeConstructor; @@ -206,6 +209,7 @@ public class DeclarationsChecker { DeclarationDescriptor containingDeclaration = typeParameterDescriptor.getContainingDeclaration(); assert containingDeclaration instanceof ClassDescriptor : containingDeclaration; JetClassOrObject psiElement = (JetClassOrObject) DescriptorToSourceUtils.getSourceFromDescriptor(classDescriptor); + assert psiElement != null; JetDelegationSpecifierList delegationSpecifierList = psiElement.getDelegationSpecifierList(); assert delegationSpecifierList != null; // trace.getErrorHandler().genericError(delegationSpecifierList.getNode(), "Type parameter " + typeParameterDescriptor.getName() + " of " + containingDeclaration.getName() + " has inconsistent values: " + conflictingTypes); @@ -535,11 +539,65 @@ public class DeclarationsChecker { } } + // Temporary + // Returns true if deprecated constructor is in use, like + // ENTRY: Enum(arguments) instead of + // ENTRY(arguments) + public static boolean enumEntryUsesDeprecatedSuperConstructor(@NotNull JetEnumEntry enumEntry) { + JetInitializerList initializerList = enumEntry.getInitializerList(); + if (initializerList == null) return false; + JetTypeReference typeReference = initializerList.getInitializers().get(0).getTypeReference(); + if (typeReference == null) return false; + JetUserType userType = (JetUserType) typeReference.getTypeElement(); + if (userType == null || userType.getReferenceExpression() instanceof JetEnumEntrySuperclassReferenceExpression) return false; + return true; + } + + // Temporary + // Returns comma if it's an enum entry without following comma (entry is not last in enum), + // or semicolon if it's an enum entry without following semicolon, may be after comma (entry is last in enum), + // or empty string if an enum entry has the necessary following delimiter + @NotNull + private static String enumEntryExpectedDelimiter(@NotNull JetEnumEntry enumEntry) { + PsiElement next = enumEntry.getNextSibling(); + while (next != null) { + if (next instanceof JetDeclaration) break; + next = next.getNextSibling(); + } + JetDeclaration nextDeclaration = (JetDeclaration) next; + next = PsiUtilPackage.getNextSiblingIgnoringWhitespace(enumEntry); + IElementType nextType = next.getNode().getElementType(); + if (nextDeclaration instanceof JetEnumEntry) { + // Not last + return nextType != JetTokens.COMMA ? "," : ""; + } + else { + // Last: after it we can have semicolon, just closing brace, or comma followed by semicolon / closing brace + if (nextType == JetTokens.COMMA) { + next = PsiUtilPackage.getNextSiblingIgnoringWhitespace(next); + nextType = next.getNode().getElementType(); + } + return nextType != JetTokens.SEMICOLON && nextType != JetTokens.RBRACE ? ";" : ""; + } + } + + public static boolean enumEntryUsesDeprecatedOrNoDelimiter(@NotNull JetEnumEntry enumEntry) { + return !enumEntryExpectedDelimiter(enumEntry).isEmpty(); + } + 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; ClassDescriptor enumClass = (ClassDescriptor) declaration; + if (enumEntryUsesDeprecatedSuperConstructor(enumEntry)) { + trace.report(Errors.ENUM_ENTRY_USES_DEPRECATED_SUPER_CONSTRUCTOR.on(enumEntry, classDescriptor)); + } + String neededDelimiter = enumEntryExpectedDelimiter(enumEntry); + if (!neededDelimiter.isEmpty()) { + trace.report(Errors.ENUM_ENTRY_USES_DEPRECATED_OR_NO_DELIMITER.on(enumEntry, classDescriptor, neededDelimiter)); + } + List delegationSpecifiers = enumEntry.getDelegationSpecifiers(); ConstructorDescriptor constructor = enumClass.getUnsubstitutedPrimaryConstructor(); if ((constructor == null || !constructor.getValueParameters().isEmpty()) && delegationSpecifiers.isEmpty()) { diff --git a/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnEnum1.kt b/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnEnum1.kt index 4d14d3ff6c4..6a9d1bc73b3 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnEnum1.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnEnum1.kt @@ -1,6 +1,6 @@ enum class A { - ONE - TWO + ONE, + TWO; fun invoke(i: Int) = i } diff --git a/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnEnum2.kt b/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnEnum2.kt index af27ab1b206..24db38cf2dd 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnEnum2.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnEnum2.kt @@ -1,5 +1,5 @@ enum class A { - ONE + ONE, TWO } diff --git a/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.kt b/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.kt index 784ad24c681..5533fc8e3ee 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum1.kt @@ -1,8 +1,8 @@ import A.ONE enum class A { - ONE - TWO + ONE, + TWO; fun invoke(i: Int) = i } diff --git a/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.kt b/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.kt index 08cab50069c..81a18fa173b 100644 --- a/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.kt +++ b/compiler/testData/codegen/box/diagnostics/functions/invoke/onObjects/invokeOnImportedEnum2.kt @@ -1,7 +1,7 @@ import A.ONE enum class A { - ONE + ONE, TWO } diff --git a/compiler/testData/diagnostics/tests/classObjects/InnerClassAccessThroughEnum.kt b/compiler/testData/diagnostics/tests/classObjects/InnerClassAccessThroughEnum.kt index ef97a9c2958..f8be2f7d2c9 100644 --- a/compiler/testData/diagnostics/tests/classObjects/InnerClassAccessThroughEnum.kt +++ b/compiler/testData/diagnostics/tests/classObjects/InnerClassAccessThroughEnum.kt @@ -2,7 +2,7 @@ package a enum class C { - E1 E2 E3 { + E1, E2, E3 { object O_O fun b() { @@ -10,7 +10,7 @@ enum class C { } class G - } + }, E4 { fun c() { @@ -22,7 +22,7 @@ enum class C { //TODO: this is a bug this.A() } - } + }; class A inner class B diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt index a3684704dc0..43369b5c33f 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt @@ -71,11 +71,11 @@ fun t1() { enum class ProtocolState { WAITING { override fun signal() = ProtocolState.TALKING - } + }, TALKING { override fun signal() = ProtocolState.WAITING - } + }; abstract fun signal() : ProtocolState } diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1185enums.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1185enums.kt index f25b1645484..f8c297b8643 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1185enums.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt1185enums.kt @@ -3,9 +3,9 @@ package kt1185 enum class Direction { - NORTH - SOUTH - WEST + NORTH, + SOUTH, + WEST, EAST } @@ -16,9 +16,9 @@ class A { } enum class Color(val rgb : Int) { - RED : Color(0xFF0000) - GREEN : Color(0x00FF00) - BLUE : Color(0x0000FF) + RED(0xFF0000), + GREEN(0x00FF00), + BLUE(0x0000FF) } fun foo(d: Direction) = when(d) { //no 'else' should be requested diff --git a/compiler/testData/diagnostics/tests/declarationChecks/kt1193.kt b/compiler/testData/diagnostics/tests/declarationChecks/kt1193.kt index 81a5fd9d3ed..69c172272b4 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/kt1193.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/kt1193.kt @@ -4,13 +4,13 @@ package kt1193 enum class MyEnum(val i: Int) { - A : MyEnum(12) + A(12), B //no error } open class A(x: Int = 1) enum class MyOtherEnum(val i: Int) { - X : A(3) - Y : A() - Z : A(3) {} + X : A(3), + Y : A(), + Z : A(3) {} } diff --git a/compiler/testData/diagnostics/tests/duplicateJvmSignature/synthesized/enumValuesValueOf.kt b/compiler/testData/diagnostics/tests/duplicateJvmSignature/synthesized/enumValuesValueOf.kt index 3bda966bc39..b432ca7abe7 100644 --- a/compiler/testData/diagnostics/tests/duplicateJvmSignature/synthesized/enumValuesValueOf.kt +++ b/compiler/testData/diagnostics/tests/duplicateJvmSignature/synthesized/enumValuesValueOf.kt @@ -1,6 +1,6 @@ enum class A { - A1 - A2 + A1, + A2; fun valueOf(s: String): A = valueOf(s) diff --git a/compiler/testData/diagnostics/tests/enum/AbstractOverrideInEnum.kt b/compiler/testData/diagnostics/tests/enum/AbstractOverrideInEnum.kt index f053dfbf5a6..bb97e9dce60 100644 --- a/compiler/testData/diagnostics/tests/enum/AbstractOverrideInEnum.kt +++ b/compiler/testData/diagnostics/tests/enum/AbstractOverrideInEnum.kt @@ -2,7 +2,7 @@ enum class E : T { ENTRY { override fun f() { } - } + }; abstract override fun f() } diff --git a/compiler/testData/diagnostics/tests/enum/classObjectInEnum.kt b/compiler/testData/diagnostics/tests/enum/classObjectInEnum.kt index 1da92d8da3e..2dfdccc2e2c 100644 --- a/compiler/testData/diagnostics/tests/enum/classObjectInEnum.kt +++ b/compiler/testData/diagnostics/tests/enum/classObjectInEnum.kt @@ -1,5 +1,5 @@ enum class E { - ENTRY + ENTRY; companion object { fun entry() = ENTRY diff --git a/compiler/testData/diagnostics/tests/enum/classObjectInEnumPrivate.kt b/compiler/testData/diagnostics/tests/enum/classObjectInEnumPrivate.kt index fe3ad2c99ed..7925a85afbd 100644 --- a/compiler/testData/diagnostics/tests/enum/classObjectInEnumPrivate.kt +++ b/compiler/testData/diagnostics/tests/enum/classObjectInEnumPrivate.kt @@ -1,5 +1,5 @@ enum class E { - ENTRY + ENTRY; private companion object } diff --git a/compiler/testData/diagnostics/tests/enum/dontCreatePackageTypeForEnumEntry.kt b/compiler/testData/diagnostics/tests/enum/dontCreatePackageTypeForEnumEntry.kt index 3835008d4e1..390fddb281c 100644 --- a/compiler/testData/diagnostics/tests/enum/dontCreatePackageTypeForEnumEntry.kt +++ b/compiler/testData/diagnostics/tests/enum/dontCreatePackageTypeForEnumEntry.kt @@ -1,8 +1,8 @@ enum class E { - FIRST + FIRST, SECOND { class A - } + }; } val foo: Any.() -> Unit = {} diff --git a/compiler/testData/diagnostics/tests/enum/entryShouldBeOfEnumType.kt b/compiler/testData/diagnostics/tests/enum/entryShouldBeOfEnumType.kt index 06d6499e3bc..a5e3eb5832c 100644 --- a/compiler/testData/diagnostics/tests/enum/entryShouldBeOfEnumType.kt +++ b/compiler/testData/diagnostics/tests/enum/entryShouldBeOfEnumType.kt @@ -1,5 +1,5 @@ enum class E { - E1 + E1, E2 } diff --git a/compiler/testData/diagnostics/tests/enum/enumCommaNoSemicolon.kt b/compiler/testData/diagnostics/tests/enum/enumCommaNoSemicolon.kt new file mode 100644 index 00000000000..852526b0d94 --- /dev/null +++ b/compiler/testData/diagnostics/tests/enum/enumCommaNoSemicolon.kt @@ -0,0 +1,6 @@ +enum class MyEnum { + A, + B, + + val z = 42 +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/enum/enumCommaNoSemicolon.txt b/compiler/testData/diagnostics/tests/enum/enumCommaNoSemicolon.txt new file mode 100644 index 00000000000..79594c7ce1f --- /dev/null +++ b/compiler/testData/diagnostics/tests/enum/enumCommaNoSemicolon.txt @@ -0,0 +1,38 @@ +package + +internal final enum class MyEnum : kotlin.Enum { + public enum entry A : MyEnum { + private constructor A() + internal final override /*1*/ /*fake_override*/ val z: kotlin.Int + 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 + } + + public enum entry B : MyEnum { + private constructor B() + internal final override /*1*/ /*fake_override*/ val z: kotlin.Int + 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() + internal final val z: kotlin.Int = 42 + 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 +} diff --git a/compiler/testData/diagnostics/tests/enum/enumEntryCannotHaveClassObject.kt b/compiler/testData/diagnostics/tests/enum/enumEntryCannotHaveClassObject.kt index c184e506e4a..e650bddb2b1 100644 --- a/compiler/testData/diagnostics/tests/enum/enumEntryCannotHaveClassObject.kt +++ b/compiler/testData/diagnostics/tests/enum/enumEntryCannotHaveClassObject.kt @@ -1,11 +1,11 @@ enum class E { - FIRST + FIRST, SECOND { companion object { fun foo() = 42 } - } + }; } fun f() = E.SECOND.foo() diff --git a/compiler/testData/diagnostics/tests/enum/enumEntryInAbstractEnum.kt b/compiler/testData/diagnostics/tests/enum/enumEntryInAbstractEnum.kt index 46bef27dfff..b72a2d5f69b 100644 --- a/compiler/testData/diagnostics/tests/enum/enumEntryInAbstractEnum.kt +++ b/compiler/testData/diagnostics/tests/enum/enumEntryInAbstractEnum.kt @@ -2,11 +2,11 @@ enum class EnumClass { E1 { override fun foo() = 1 override val bar: String = "a" - } + }, E2 { - } + }; abstract fun foo(): Int abstract val bar: String diff --git a/compiler/testData/diagnostics/tests/enum/enumImplementingTrait.kt b/compiler/testData/diagnostics/tests/enum/enumImplementingTrait.kt index f26059f5e59..5d46d4fd7d3 100644 --- a/compiler/testData/diagnostics/tests/enum/enumImplementingTrait.kt +++ b/compiler/testData/diagnostics/tests/enum/enumImplementingTrait.kt @@ -5,7 +5,7 @@ interface T1 { enum class EnumImplementingTraitWithFun: T1 { E1 { override fun foo() {} - } + }, E2 } @@ -16,6 +16,6 @@ interface T2 { enum class EnumImplementingTraitWithVal: T2 { E1 { override val bar = 1 - } + }, E2 } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/enum/enumMissedComma.kt b/compiler/testData/diagnostics/tests/enum/enumMissedComma.kt new file mode 100644 index 00000000000..7131b25d587 --- /dev/null +++ b/compiler/testData/diagnostics/tests/enum/enumMissedComma.kt @@ -0,0 +1,3 @@ +enum class MyEnum { + A, B, C D, E F +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/enum/enumMissedComma.txt b/compiler/testData/diagnostics/tests/enum/enumMissedComma.txt new file mode 100644 index 00000000000..cf6f07283b3 --- /dev/null +++ b/compiler/testData/diagnostics/tests/enum/enumMissedComma.txt @@ -0,0 +1,75 @@ +package + +internal final enum class MyEnum : kotlin.Enum { + public enum entry A : MyEnum { + private constructor A() + 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 + } + + public enum entry B : MyEnum { + private constructor B() + 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 + } + + public enum entry C : MyEnum { + private constructor C() + 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 + } + + public enum entry D : MyEnum { + private constructor D() + 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 + } + + public enum entry E : MyEnum { + private constructor E() + 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 + } + + public enum entry F : MyEnum { + private constructor F() + 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 +} diff --git a/compiler/testData/diagnostics/tests/enum/enumNoComma.kt b/compiler/testData/diagnostics/tests/enum/enumNoComma.kt new file mode 100644 index 00000000000..b878d606427 --- /dev/null +++ b/compiler/testData/diagnostics/tests/enum/enumNoComma.kt @@ -0,0 +1,4 @@ +enum class MyEnum { + A + B +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/enum/enumNoComma.txt b/compiler/testData/diagnostics/tests/enum/enumNoComma.txt new file mode 100644 index 00000000000..990870509c6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/enum/enumNoComma.txt @@ -0,0 +1,35 @@ +package + +internal final enum class MyEnum : kotlin.Enum { + public enum entry A : MyEnum { + private constructor A() + 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 + } + + public enum entry B : MyEnum { + private constructor B() + 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 +} diff --git a/compiler/testData/diagnostics/tests/enum/enumNoSemicolon.kt b/compiler/testData/diagnostics/tests/enum/enumNoSemicolon.kt new file mode 100644 index 00000000000..8e7da05a9a1 --- /dev/null +++ b/compiler/testData/diagnostics/tests/enum/enumNoSemicolon.kt @@ -0,0 +1,6 @@ +enum class MyEnum { + A, + B + + val z = 42 +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/enum/enumNoSemicolon.txt b/compiler/testData/diagnostics/tests/enum/enumNoSemicolon.txt new file mode 100644 index 00000000000..79594c7ce1f --- /dev/null +++ b/compiler/testData/diagnostics/tests/enum/enumNoSemicolon.txt @@ -0,0 +1,38 @@ +package + +internal final enum class MyEnum : kotlin.Enum { + public enum entry A : MyEnum { + private constructor A() + internal final override /*1*/ /*fake_override*/ val z: kotlin.Int + 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 + } + + public enum entry B : MyEnum { + private constructor B() + internal final override /*1*/ /*fake_override*/ val z: kotlin.Int + 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() + internal final val z: kotlin.Int = 42 + 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 +} diff --git a/compiler/testData/diagnostics/tests/enum/enumOldConstructor.kt b/compiler/testData/diagnostics/tests/enum/enumOldConstructor.kt new file mode 100644 index 00000000000..7598574b652 --- /dev/null +++ b/compiler/testData/diagnostics/tests/enum/enumOldConstructor.kt @@ -0,0 +1,6 @@ +enum class MyEnum(val myArg: Int) { + FIRST(1), + SECOND: MyEnum(2), + THIRD(3), + FOURTH(4) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/enum/enumOldConstructor.txt b/compiler/testData/diagnostics/tests/enum/enumOldConstructor.txt new file mode 100644 index 00000000000..5b901b7ef1f --- /dev/null +++ b/compiler/testData/diagnostics/tests/enum/enumOldConstructor.txt @@ -0,0 +1,60 @@ +package + +internal final enum class MyEnum : kotlin.Enum { + public enum entry FIRST : MyEnum { + private constructor FIRST() + internal final override /*1*/ /*fake_override*/ val myArg: kotlin.Int + 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 + } + + public enum entry SECOND : MyEnum { + private constructor SECOND() + internal final override /*1*/ /*fake_override*/ val myArg: kotlin.Int + 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 + } + + public enum entry THIRD : MyEnum { + private constructor THIRD() + internal final override /*1*/ /*fake_override*/ val myArg: kotlin.Int + 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 + } + + public enum entry FOURTH : MyEnum { + private constructor FOURTH() + internal final override /*1*/ /*fake_override*/ val myArg: kotlin.Int + 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(/*0*/ myArg: kotlin.Int) + internal final val myArg: kotlin.Int + 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 +} diff --git a/compiler/testData/diagnostics/tests/enum/enumOldConstructorNamedArgument.kt b/compiler/testData/diagnostics/tests/enum/enumOldConstructorNamedArgument.kt new file mode 100644 index 00000000000..4ada8b51c78 --- /dev/null +++ b/compiler/testData/diagnostics/tests/enum/enumOldConstructorNamedArgument.kt @@ -0,0 +1,6 @@ +enum class MyEnum(val myArg: Int) { + FIRST(1), + SECOND: MyEnum(myArg = 2), + THIRD(3), + FOURTH(4) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/enum/enumOldConstructorNamedArgument.txt b/compiler/testData/diagnostics/tests/enum/enumOldConstructorNamedArgument.txt new file mode 100644 index 00000000000..5b901b7ef1f --- /dev/null +++ b/compiler/testData/diagnostics/tests/enum/enumOldConstructorNamedArgument.txt @@ -0,0 +1,60 @@ +package + +internal final enum class MyEnum : kotlin.Enum { + public enum entry FIRST : MyEnum { + private constructor FIRST() + internal final override /*1*/ /*fake_override*/ val myArg: kotlin.Int + 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 + } + + public enum entry SECOND : MyEnum { + private constructor SECOND() + internal final override /*1*/ /*fake_override*/ val myArg: kotlin.Int + 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 + } + + public enum entry THIRD : MyEnum { + private constructor THIRD() + internal final override /*1*/ /*fake_override*/ val myArg: kotlin.Int + 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 + } + + public enum entry FOURTH : MyEnum { + private constructor FOURTH() + internal final override /*1*/ /*fake_override*/ val myArg: kotlin.Int + 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(/*0*/ myArg: kotlin.Int) + internal final val myArg: kotlin.Int + 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 +} diff --git a/compiler/testData/diagnostics/tests/enum/enumOldConstructors.kt b/compiler/testData/diagnostics/tests/enum/enumOldConstructors.kt new file mode 100644 index 00000000000..288285fb969 --- /dev/null +++ b/compiler/testData/diagnostics/tests/enum/enumOldConstructors.kt @@ -0,0 +1,6 @@ +enum class MyEnum(val myArg: Int) { + FIRST: MyEnum(1), + SECOND: MyEnum(2), + THIRD: MyEnum(3), + FOURTH: MyEnum(4) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/enum/enumOldConstructors.txt b/compiler/testData/diagnostics/tests/enum/enumOldConstructors.txt new file mode 100644 index 00000000000..5b901b7ef1f --- /dev/null +++ b/compiler/testData/diagnostics/tests/enum/enumOldConstructors.txt @@ -0,0 +1,60 @@ +package + +internal final enum class MyEnum : kotlin.Enum { + public enum entry FIRST : MyEnum { + private constructor FIRST() + internal final override /*1*/ /*fake_override*/ val myArg: kotlin.Int + 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 + } + + public enum entry SECOND : MyEnum { + private constructor SECOND() + internal final override /*1*/ /*fake_override*/ val myArg: kotlin.Int + 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 + } + + public enum entry THIRD : MyEnum { + private constructor THIRD() + internal final override /*1*/ /*fake_override*/ val myArg: kotlin.Int + 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 + } + + public enum entry FOURTH : MyEnum { + private constructor FOURTH() + internal final override /*1*/ /*fake_override*/ val myArg: kotlin.Int + 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(/*0*/ myArg: kotlin.Int) + internal final val myArg: kotlin.Int + 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 +} diff --git a/compiler/testData/diagnostics/tests/enum/enumStarImport.kt b/compiler/testData/diagnostics/tests/enum/enumStarImport.kt index f0c53cd4450..59cd5488439 100644 --- a/compiler/testData/diagnostics/tests/enum/enumStarImport.kt +++ b/compiler/testData/diagnostics/tests/enum/enumStarImport.kt @@ -3,7 +3,7 @@ package enum enum class HappyEnum { - CASE1 + CASE1, CASE2 } diff --git a/compiler/testData/diagnostics/tests/enum/inheritanceFromEnum.kt b/compiler/testData/diagnostics/tests/enum/inheritanceFromEnum.kt index 31a5fcd847c..febf92f1f96 100644 --- a/compiler/testData/diagnostics/tests/enum/inheritanceFromEnum.kt +++ b/compiler/testData/diagnostics/tests/enum/inheritanceFromEnum.kt @@ -3,7 +3,7 @@ public enum MyJavaEnum {} // FILE: test.kt open enum class MyEnum() { - A: MyEnum() + A() } enum class MyEnum2() {} diff --git a/compiler/testData/diagnostics/tests/enum/inner/insideEnum.kt b/compiler/testData/diagnostics/tests/enum/inner/insideEnum.kt index f4a9d75cb88..e85746eb8eb 100644 --- a/compiler/testData/diagnostics/tests/enum/inner/insideEnum.kt +++ b/compiler/testData/diagnostics/tests/enum/inner/insideEnum.kt @@ -1,5 +1,5 @@ enum class E { - ABC + ABC; enum class F { DEF diff --git a/compiler/testData/diagnostics/tests/enum/kt2834.kt b/compiler/testData/diagnostics/tests/enum/kt2834.kt index da51cbdc694..44f26d5a35c 100644 --- a/compiler/testData/diagnostics/tests/enum/kt2834.kt +++ b/compiler/testData/diagnostics/tests/enum/kt2834.kt @@ -1,5 +1,5 @@ private enum class MethodKind { - INSTANCE + INSTANCE, STATIC } diff --git a/compiler/testData/diagnostics/tests/enum/localEnums.kt b/compiler/testData/diagnostics/tests/enum/localEnums.kt index f172891c9bc..dd5f20fd7d9 100644 --- a/compiler/testData/diagnostics/tests/enum/localEnums.kt +++ b/compiler/testData/diagnostics/tests/enum/localEnums.kt @@ -2,7 +2,7 @@ fun foo() { enum class A { - FOO + FOO, BAR } val foo = A.FOO diff --git a/compiler/testData/diagnostics/tests/enum/modifiersOnEnumEntry.kt b/compiler/testData/diagnostics/tests/enum/modifiersOnEnumEntry.kt index 21fa319bc1a..4cd63001527 100644 --- a/compiler/testData/diagnostics/tests/enum/modifiersOnEnumEntry.kt +++ b/compiler/testData/diagnostics/tests/enum/modifiersOnEnumEntry.kt @@ -1,23 +1,23 @@ enum class E { public final SUBCLASS { fun foo() {} - } + }, - public PUBLIC - protected PROTECTED - private PRIVATE - internal INTERNAL + public PUBLIC, + protected PROTECTED, + private PRIVATE, + internal INTERNAL, - abstract ABSTRACT - open OPEN - override OVERRIDE - final FINAL + abstract ABSTRACT, + open OPEN, + override OVERRIDE, + final FINAL, - inner INNER - annotation ANNOTATION - enum ENUM - out OUT - in IN - vararg VARARG + inner INNER, + annotation ANNOTATION, + enum ENUM, + out OUT, + in IN, + vararg VARARG, reified REIFIED } diff --git a/compiler/testData/diagnostics/tests/enum/openMemberInEnum.kt b/compiler/testData/diagnostics/tests/enum/openMemberInEnum.kt index f9a9e4b9ee2..d5e1eda0052 100644 --- a/compiler/testData/diagnostics/tests/enum/openMemberInEnum.kt +++ b/compiler/testData/diagnostics/tests/enum/openMemberInEnum.kt @@ -2,12 +2,12 @@ enum class EnumWithOpenMembers { E1 { override fun foo() = 1 override val bar: String = "a" - } + }, E2 { override fun f() = 3 override val b = 4 - } + }; open fun foo() = 1 open val bar: String = "" diff --git a/compiler/testData/diagnostics/tests/enum/starImportNestedClassAndEntries.kt b/compiler/testData/diagnostics/tests/enum/starImportNestedClassAndEntries.kt index 22bcf3d7748..b2b9ba97aa3 100644 --- a/compiler/testData/diagnostics/tests/enum/starImportNestedClassAndEntries.kt +++ b/compiler/testData/diagnostics/tests/enum/starImportNestedClassAndEntries.kt @@ -2,8 +2,8 @@ package foo enum class E { - ENTRY - ANOTHER + ENTRY, + ANOTHER; class Nested { companion object { diff --git a/compiler/testData/diagnostics/tests/enum/typeParametersInEnum.kt b/compiler/testData/diagnostics/tests/enum/typeParametersInEnum.kt index c9001c094bc..556b9b8845d 100644 --- a/compiler/testData/diagnostics/tests/enum/typeParametersInEnum.kt +++ b/compiler/testData/diagnostics/tests/enum/typeParametersInEnum.kt @@ -3,5 +3,5 @@ package bug public enum class Foo { - A : Foo() + A : Foo() } diff --git a/compiler/testData/diagnostics/tests/enum/valuesValueOfAndEntriesAccessibility.kt b/compiler/testData/diagnostics/tests/enum/valuesValueOfAndEntriesAccessibility.kt index fdeeaa86a42..b3580c5fac2 100644 --- a/compiler/testData/diagnostics/tests/enum/valuesValueOfAndEntriesAccessibility.kt +++ b/compiler/testData/diagnostics/tests/enum/valuesValueOfAndEntriesAccessibility.kt @@ -1,5 +1,5 @@ enum class E { - ENTRY + ENTRY; companion object { fun foo(): E = ENTRY diff --git a/compiler/testData/diagnostics/tests/imports/StarImportFromObject.kt b/compiler/testData/diagnostics/tests/imports/StarImportFromObject.kt index 7629cc09f3e..e078b992719 100644 --- a/compiler/testData/diagnostics/tests/imports/StarImportFromObject.kt +++ b/compiler/testData/diagnostics/tests/imports/StarImportFromObject.kt @@ -36,7 +36,7 @@ class A { } enum class E { - E1 E2 + E1, E2 } object B { diff --git a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteEnumReference.kt b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteEnumReference.kt index d95209adbd0..ef56e1ca39a 100644 --- a/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteEnumReference.kt +++ b/compiler/testData/diagnostics/tests/incompleteCode/diagnosticWithSyntaxError/incompleteEnumReference.kt @@ -1,6 +1,6 @@ enum class E { - A - B + A, + B, C } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt3007.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt3007.kt index 49ac9ad9eef..0e34c12a33f 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt3007.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt3007.kt @@ -2,7 +2,7 @@ package a enum class SomeEnum { - FIRST + FIRST, SECOND } diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt3038.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt3038.kt index d8201eb0872..91b04c12d41 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt3038.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt3038.kt @@ -2,7 +2,7 @@ package a enum class TestEnum { - FIRST + FIRST, SECOND } diff --git a/compiler/testData/diagnostics/tests/inline/nonLocalReturns/nestedNonLocals.kt b/compiler/testData/diagnostics/tests/inline/nonLocalReturns/nestedNonLocals.kt index 9f09e8ee266..023306d08b8 100644 --- a/compiler/testData/diagnostics/tests/inline/nonLocalReturns/nestedNonLocals.kt +++ b/compiler/testData/diagnostics/tests/inline/nonLocalReturns/nestedNonLocals.kt @@ -2,8 +2,8 @@ import Kind.EXT_RETURN import Kind.GLOBAL_RETURN enum class Kind { - LOCAL - EXT_RETURN + LOCAL, + EXT_RETURN, GLOBAL_RETURN } diff --git a/compiler/testData/diagnostics/tests/inner/enumEntries.kt b/compiler/testData/diagnostics/tests/inner/enumEntries.kt index 49f8711cbe6..713d8c9af1d 100644 --- a/compiler/testData/diagnostics/tests/inner/enumEntries.kt +++ b/compiler/testData/diagnostics/tests/inner/enumEntries.kt @@ -1,10 +1,10 @@ enum class E { E1 { override fun foo() = outerFun() + super.outerFun() - } + }, E2 { override fun foo() = E1.foo() - } + }; abstract fun foo(): Int diff --git a/compiler/testData/diagnostics/tests/inner/illegalModifier.kt b/compiler/testData/diagnostics/tests/inner/illegalModifier.kt index 340d6175aa8..e5573d81d69 100644 --- a/compiler/testData/diagnostics/tests/inner/illegalModifier.kt +++ b/compiler/testData/diagnostics/tests/inner/illegalModifier.kt @@ -17,7 +17,7 @@ class D { enum class H { inner I { inner class II - } + }; inner class J } diff --git a/compiler/testData/diagnostics/tests/inner/qualifiedExpression/enumConstant.kt b/compiler/testData/diagnostics/tests/inner/qualifiedExpression/enumConstant.kt index bc777fe834c..431424518a0 100644 --- a/compiler/testData/diagnostics/tests/inner/qualifiedExpression/enumConstant.kt +++ b/compiler/testData/diagnostics/tests/inner/qualifiedExpression/enumConstant.kt @@ -1,6 +1,6 @@ enum class E { - E1 - E2 { } + E1, + E2 { }; } fun foo() = E.E1 diff --git a/compiler/testData/diagnostics/tests/inner/qualifiedExpression/nestedEnumConstant.kt b/compiler/testData/diagnostics/tests/inner/qualifiedExpression/nestedEnumConstant.kt index 033826556c1..a4f370e65ae 100644 --- a/compiler/testData/diagnostics/tests/inner/qualifiedExpression/nestedEnumConstant.kt +++ b/compiler/testData/diagnostics/tests/inner/qualifiedExpression/nestedEnumConstant.kt @@ -1,7 +1,7 @@ class A { enum class E { - E1 - E2 { } + E1, + E2 { }; } } diff --git a/compiler/testData/diagnostics/tests/modifiers/defaultModifier.kt b/compiler/testData/diagnostics/tests/modifiers/defaultModifier.kt index 0b2d020f1f6..67e1a954575 100644 --- a/compiler/testData/diagnostics/tests/modifiers/defaultModifier.kt +++ b/compiler/testData/diagnostics/tests/modifiers/defaultModifier.kt @@ -38,8 +38,8 @@ class J { } companion enum class Enum { - E1 - E2 + E1, + E2; companion object } diff --git a/compiler/testData/diagnostics/tests/redeclarations/NoRedeclarationForEnumEntriesAndDefaultObjectMembers.kt b/compiler/testData/diagnostics/tests/redeclarations/NoRedeclarationForEnumEntriesAndDefaultObjectMembers.kt index 1a0cb9798e2..cc2979f1768 100644 --- a/compiler/testData/diagnostics/tests/redeclarations/NoRedeclarationForEnumEntriesAndDefaultObjectMembers.kt +++ b/compiler/testData/diagnostics/tests/redeclarations/NoRedeclarationForEnumEntriesAndDefaultObjectMembers.kt @@ -1,7 +1,7 @@ enum class E { - FIRST + FIRST, - SECOND + SECOND; companion object { class FIRST diff --git a/compiler/testData/diagnostics/tests/redeclarations/SingletonAndFunctionSameName.kt b/compiler/testData/diagnostics/tests/redeclarations/SingletonAndFunctionSameName.kt index 916df0c530c..cfe27ced1de 100644 --- a/compiler/testData/diagnostics/tests/redeclarations/SingletonAndFunctionSameName.kt +++ b/compiler/testData/diagnostics/tests/redeclarations/SingletonAndFunctionSameName.kt @@ -11,9 +11,9 @@ object Foo { fun En() = 239 enum class En { - ENTRY + ENTRY, - SUBCLASS { } + SUBCLASS { }; fun ENTRY() = 42 diff --git a/compiler/testData/diagnostics/tests/redeclarations/kt2418.kt b/compiler/testData/diagnostics/tests/redeclarations/kt2418.kt index e12db2d2989..c9419f04ff9 100644 --- a/compiler/testData/diagnostics/tests/redeclarations/kt2418.kt +++ b/compiler/testData/diagnostics/tests/redeclarations/kt2418.kt @@ -3,24 +3,24 @@ package kt2418 enum class A { - FOO + FOO, FOO } enum class B { - FOO + FOO; fun FOO() {} } enum class C { - FOO + FOO; val FOO = 1 } enum class D { - FOO + FOO; class FOO {} } diff --git a/compiler/testData/diagnostics/tests/regressions/Jet183-1.kt b/compiler/testData/diagnostics/tests/regressions/Jet183-1.kt index 3722ecde425..8103acc9fd3 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet183-1.kt +++ b/compiler/testData/diagnostics/tests/regressions/Jet183-1.kt @@ -1,11 +1,11 @@ enum class ProtocolState { WAITING { override fun signal() = ProtocolState.TALKING - } + }, TALKING { override fun signal() = ProtocolState.WAITING - } + }; abstract fun signal() : ProtocolState } diff --git a/compiler/testData/diagnostics/tests/regressions/Jet183.kt b/compiler/testData/diagnostics/tests/regressions/Jet183.kt index 8d872a5f8d9..c6f7516117f 100644 --- a/compiler/testData/diagnostics/tests/regressions/Jet183.kt +++ b/compiler/testData/diagnostics/tests/regressions/Jet183.kt @@ -1,11 +1,11 @@ enum class ProtocolState { WAITING { override fun signal() = ProtocolState.TALKING - } + }, TALKING { override fun signal() = ProtocolState.WAITING - } + }; abstract fun signal() : ProtocolState } diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/kt4321InvokeOnEnum.kt b/compiler/testData/diagnostics/tests/resolve/invoke/kt4321InvokeOnEnum.kt index 5895e7121b7..1356cbaec06 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/kt4321InvokeOnEnum.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/kt4321InvokeOnEnum.kt @@ -4,7 +4,7 @@ import DOMElementTestClasses.cls2 // use case 1 enum class DOMElementTestClasses { - cls1 cls2 + cls1, cls2; fun invoke() {} } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInObject.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInObject.kt index eb98b90d088..8d739749120 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInObject.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInObject.kt @@ -4,7 +4,7 @@ object A { } enum class B { - X : B() { + X() { constructor() } } diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/enums.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/enums.kt index c46ace21313..134e0881e8a 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/enums.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/enums.kt @@ -1,6 +1,6 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER enum class A { - W: A(1) X: A(1, 2) Y: A(3.0) Z: A("") E: A() + W(1), X(1, 2), Y(3.0), Z(""), E(); constructor() constructor(x: Int) @@ -10,7 +10,7 @@ enum class A { } enum class B(x: Int) { - W: B(1) X: B(1, 2) Y: B(3.0) Z: B("") + W(1), X(1, 2), Y(3.0), Z(""); constructor(x: Int, y: Int): this(x+y) constructor(x: Double): this(x.toInt(), 1) @@ -18,20 +18,20 @@ enum class B(x: Int) { } enum class C { - EMPTY: C() // may be we should avoid explicit call here + EMPTY(); // may be we should avoid explicit call here constructor() } enum class D(val prop: Int) { - X: D(123) { + X(123) { override fun f() = 1 - } - Y: D() { + }, + Y() { override fun f() = prop - } - Z: D("abc") { + }, + Z("abc") { override fun f() = prop - } + }; constructor(): this(1) constructor(x: String): this(x.length()) diff --git a/compiler/testData/diagnostics/tests/when/ElseOnNullableEnum.kt b/compiler/testData/diagnostics/tests/when/ElseOnNullableEnum.kt index 662b0fa0e4d..787d09c9927 100644 --- a/compiler/testData/diagnostics/tests/when/ElseOnNullableEnum.kt +++ b/compiler/testData/diagnostics/tests/when/ElseOnNullableEnum.kt @@ -2,7 +2,7 @@ // FILE: 1.kt -enum class E { A B } +enum class E { A, B } fun test(e: E?) = when (e) { E.A -> 1 diff --git a/compiler/testData/diagnostics/tests/when/ElseOnNullableEnumWithSmartCast.kt b/compiler/testData/diagnostics/tests/when/ElseOnNullableEnumWithSmartCast.kt index 3111316709d..f0f8219837f 100644 --- a/compiler/testData/diagnostics/tests/when/ElseOnNullableEnumWithSmartCast.kt +++ b/compiler/testData/diagnostics/tests/when/ElseOnNullableEnumWithSmartCast.kt @@ -1,4 +1,4 @@ -enum class E { A B } +enum class E { A, B } fun foo(e: E, something: Any?): Int { if (something != null) return 0 diff --git a/compiler/testData/diagnostics/testsWithJsStdLib/unsupportedFeatures/nestedInnerClassifier.kt b/compiler/testData/diagnostics/testsWithJsStdLib/unsupportedFeatures/nestedInnerClassifier.kt index 95715883076..a7f842b11ee 100644 --- a/compiler/testData/diagnostics/testsWithJsStdLib/unsupportedFeatures/nestedInnerClassifier.kt +++ b/compiler/testData/diagnostics/testsWithJsStdLib/unsupportedFeatures/nestedInnerClassifier.kt @@ -22,7 +22,7 @@ class A { } enum class E { - X Y + X, Y; companion object {} } @@ -52,7 +52,7 @@ interface T { } enum class E { - X Y + X, Y; companion object {} } @@ -61,7 +61,7 @@ interface T { } enum class E { - X Y + X, Y; class B { class C @@ -86,7 +86,7 @@ enum class E { } enum class E { - X Y + X, Y; companion object {} } diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index e69083057dd..21adbd335d7 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -4176,6 +4176,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } + @TestMetadata("enumCommaNoSemicolon.kt") + public void testEnumCommaNoSemicolon() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumCommaNoSemicolon.kt"); + doTest(fileName); + } + @TestMetadata("enumEntryCannotHaveClassObject.kt") public void testEnumEntryCannotHaveClassObject() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumEntryCannotHaveClassObject.kt"); @@ -4206,6 +4212,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } + @TestMetadata("enumMissedComma.kt") + public void testEnumMissedComma() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumMissedComma.kt"); + doTest(fileName); + } + @TestMetadata("enumMissingName.kt") public void testEnumMissingName() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumMissingName.kt"); @@ -4218,6 +4230,36 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } + @TestMetadata("enumNoComma.kt") + public void testEnumNoComma() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumNoComma.kt"); + doTest(fileName); + } + + @TestMetadata("enumNoSemicolon.kt") + public void testEnumNoSemicolon() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumNoSemicolon.kt"); + doTest(fileName); + } + + @TestMetadata("enumOldConstructor.kt") + public void testEnumOldConstructor() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumOldConstructor.kt"); + doTest(fileName); + } + + @TestMetadata("enumOldConstructorNamedArgument.kt") + public void testEnumOldConstructorNamedArgument() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumOldConstructorNamedArgument.kt"); + doTest(fileName); + } + + @TestMetadata("enumOldConstructors.kt") + public void testEnumOldConstructors() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumOldConstructors.kt"); + doTest(fileName); + } + @TestMetadata("enumStarImport.kt") public void testEnumStarImport() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/enum/enumStarImport.kt"); diff --git a/idea/testData/checker/ClassObjectInEnum.kt b/idea/testData/checker/ClassObjectInEnum.kt index fdeeaa86a42..b3580c5fac2 100644 --- a/idea/testData/checker/ClassObjectInEnum.kt +++ b/idea/testData/checker/ClassObjectInEnum.kt @@ -1,5 +1,5 @@ enum class E { - ENTRY + ENTRY; companion object { fun foo(): E = ENTRY diff --git a/idea/testData/checker/Redeclaration.kt b/idea/testData/checker/Redeclaration.kt index 22f0b883675..3e43242f2f7 100644 --- a/idea/testData/checker/Redeclaration.kt +++ b/idea/testData/checker/Redeclaration.kt @@ -5,7 +5,7 @@ val a : Int = 1 fun foo() {} enum class EnumClass { - FOO + FOO, FOO } diff --git a/idea/testData/checker/WhenInEnumInExtensionProperty.kt b/idea/testData/checker/WhenInEnumInExtensionProperty.kt index 5217d16fdf7..03f847df429 100644 --- a/idea/testData/checker/WhenInEnumInExtensionProperty.kt +++ b/idea/testData/checker/WhenInEnumInExtensionProperty.kt @@ -1,7 +1,7 @@ // KT-3750 When without else enum class A { - e1 + e1, e2 } class B(val a: A) diff --git a/idea/testData/checker/regression/Jet183-1.kt b/idea/testData/checker/regression/Jet183-1.kt index 7d30b3c7585..256cb1cec68 100644 --- a/idea/testData/checker/regression/Jet183-1.kt +++ b/idea/testData/checker/regression/Jet183-1.kt @@ -1,11 +1,11 @@ enum class ProtocolState { WAITING { override fun signal() = ProtocolState.TALKING - } + }, TALKING { override fun signal() = ProtocolState.WAITING - } + }; abstract fun signal() : ProtocolState } diff --git a/idea/testData/checker/regression/Jet183.kt b/idea/testData/checker/regression/Jet183.kt index 4b456ffec7c..0b4ec222520 100644 --- a/idea/testData/checker/regression/Jet183.kt +++ b/idea/testData/checker/regression/Jet183.kt @@ -1,11 +1,11 @@ enum class ProtocolState { WAITING { override fun signal() = ProtocolState.TALKING - } + }, TALKING { override fun signal() = ProtocolState.WAITING - } + }; abstract fun signal() : ProtocolState } diff --git a/idea/testData/highlighter/Enums.kt b/idea/testData/highlighter/Enums.kt index 50c1ec9e3e2..835f6f1cffa 100644 --- a/idea/testData/highlighter/Enums.kt +++ b/idea/testData/highlighter/Enums.kt @@ -1,7 +1,7 @@ package testing enum class Test { - FIRST + FIRST, SECOND }