New enum syntax: Short constructor syntax introduced for entries, optional commas between entries, semicolon after entries. #KT-7605 Fixed.
Grammar changed accordingly. Semicolons prohibited after an entry except the last one. Only one initializer is allowed per entry. EnumReferenceExpression AST node introduced. Some tests fixed, a pair of new tests written. Kotlin code inside project fixed. Formatter and intendation tests fixed accordingly. Stub version is incremented.
This commit is contained in:
@@ -5,7 +5,7 @@ fun naturalOrder<in T : Comparable<T>>(a : T, b : T) : Int = a.compareTo(b)
|
||||
fun castingNaturalOrder(a : Object, b : Object) : Int = (a as Comparable<Object>).compareTo(b as Comparable<Object>)
|
||||
|
||||
enum class ComparisonResult {
|
||||
LS; EQ; GR
|
||||
LS, EQ, GR;
|
||||
}
|
||||
|
||||
typealias MatchableComparison<in T> = (T, T) -> ComparisonResult
|
||||
|
||||
@@ -217,16 +217,17 @@ JetFile: Comparison.kt
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('LS')
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('EQ')
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiElement(COMMA)(',')
|
||||
PsiWhiteSpace(' ')
|
||||
ENUM_ENTRY
|
||||
OBJECT_DECLARATION_NAME
|
||||
PsiElement(IDENTIFIER)('GR')
|
||||
PsiElement(SEMICOLON)(';')
|
||||
PsiWhiteSpace('\n')
|
||||
PsiElement(RBRACE)('}')
|
||||
PsiWhiteSpace('\n\n')
|
||||
|
||||
Reference in New Issue
Block a user