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:
Mikhail Glukhikh
2015-05-05 19:55:25 +03:00
parent 67cce57aeb
commit 1a312140e9
48 changed files with 1152 additions and 91 deletions
@@ -27,14 +27,9 @@ open class C1
open class C2
enum class Test : A1 {
FIRST_ITEM : Test(), C1(),
C2()
FIRST_ITEM : Test()
SECOND_ITEM :
Test()
THIRD_ITEM : Test(),
C1()
FORTH_ITEM : Test()
}
// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST
@@ -27,14 +27,9 @@ open class C1
open class C2
enum class Test : A1 {
FIRST_ITEM : Test(), C1(),
C2()
FIRST_ITEM : Test()
SECOND_ITEM :
Test()
THIRD_ITEM : Test(),
C1()
FORTH_ITEM : Test()
}
// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST
+1 -5
View File
@@ -27,13 +27,9 @@ open class C1
open class C2
enum class Test : A1 {
FIRST_ITEM : Test(), C1(),
C2()
FIRST_ITEM : Test()
SECOND_ITEM :
Test()
THIRD_ITEM : Test(),
C1() FORTH_ITEM : Test()
}
// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST
@@ -0,0 +1,6 @@
// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST
enum class EnumTest {
ENTRY: EnumTest();
<caret>
}
@@ -0,0 +1,6 @@
// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST
enum class EnumTest {
ENTRY: EnumTest();
<caret>
}
@@ -0,0 +1,5 @@
// SET_TRUE: ALIGN_MULTILINE_EXTENDS_LIST
enum class EnumTest {
ENTRY: EnumTest(); <caret>
}
@@ -4,5 +4,5 @@ interface A1
enum class EnumTest {
ENTRY: EnumTest(),
<caret>
<caret>
}
@@ -4,5 +4,5 @@ interface A1
enum class EnumTest {
ENTRY: EnumTest(),
<caret>
<caret>
}
@@ -4,5 +4,5 @@ interface A1
enum class EnumTest {
ENTRY: EnumTest(),
<caret>A1
<caret>A1
}
@@ -4,5 +4,5 @@ interface A1
enum class EnumTest {
ENTRY: EnumTest(),
<caret>A1
<caret>A1
}
@@ -169,6 +169,12 @@ public class JetTypingIndentationTestBaseGenerated extends AbstractJetTypingInde
doNewlineTest(fileName);
}
@TestMetadata("InEnumAfterSemicolon.after.kt")
public void testInEnumAfterSemicolon() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InEnumAfterSemicolon.after.kt");
doNewlineTest(fileName);
}
@TestMetadata("InEnumInitializerListAfterColon.after.kt")
public void testInEnumInitializerListAfterColon() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InEnumInitializerListAfterColon.after.kt");
@@ -385,6 +391,12 @@ public class JetTypingIndentationTestBaseGenerated extends AbstractJetTypingInde
doNewlineTestWithInvert(fileName);
}
@TestMetadata("InEnumAfterSemicolon.after.inv.kt")
public void testInEnumAfterSemicolon() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InEnumAfterSemicolon.after.inv.kt");
doNewlineTestWithInvert(fileName);
}
@TestMetadata("InEnumInitializerListAfterColon.after.inv.kt")
public void testInEnumInitializerListAfterColon() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/indentationOnNewline/InEnumInitializerListAfterColon.after.inv.kt");