Drop old enum syntax. Comma / semicolon are now a syntactic part of enum entry.

Comma must present now between enum entries, semicolon between last entry & first member, constructor calls must be without colons / specifiers.
A swarm of tests fixed accordingly.
This commit is contained in:
Mikhail Glukhikh
2015-08-05 18:22:21 +03:00
parent e5ab7de870
commit 3f14e74b08
190 changed files with 810 additions and 3201 deletions
@@ -1,8 +0,0 @@
// "Change to short enum entry super constructor" "true"
enum class MyEnum(val z: Int) {
A: MyEnum(3)<caret>
B(7)
C(12)
fun foo() = z * 2
}
@@ -1,8 +0,0 @@
// "Change to short enum entry super constructor" "true"
enum class MyEnum(val z: Int) {
A(3)
B(7)
C(12)
fun foo() = z * 2
}
@@ -1,8 +0,0 @@
// "Change to short enum entry super constructor" "true"
enum class MyEnum(val z: Int) {
A(3)
B(7)
C: MyEnum(12)<caret>
fun foo() = z * 2
}
@@ -1,8 +0,0 @@
// "Change to short enum entry super constructor" "true"
enum class MyEnum(val z: Int) {
A(3)
B(7)
C(12)
fun foo() = z * 2
}
@@ -1,11 +0,0 @@
// "Change to short enum entry super constructor in the whole project" "true"
annotation class My
annotation class Your
annotation class His
enum class MyEnum(val i: Int) {
@My FIRST: MyEnum(1)<caret>,
@My @Your SECOND: MyEnum(2),
@Your @His THIRD: MyEnum(3)
}
@@ -1,11 +0,0 @@
// "Change to short enum entry super constructor in the whole project" "true"
annotation class My
annotation class Your
annotation class His
enum class MyEnum(val i: Int) {
@My FIRST(1),
@My @Your SECOND(2),
@Your @His THIRD(3)
}
@@ -1,10 +0,0 @@
// "Change to short enum entry super constructor in the whole project" "true"
enum class MyEnum(val i: Int) {
// The first
FIRST: MyEnum(1)<caret>,
// The second
SECOND: MyEnum(2),
// The third
THIRD: MyEnum(3)
}
@@ -1,10 +0,0 @@
// "Change to short enum entry super constructor in the whole project" "true"
enum class MyEnum(val i: Int) {
// The first
FIRST(1),
// The second
SECOND(2),
// The third
THIRD(3)
}
@@ -1,16 +0,0 @@
// "Change to short enum entry super constructor in the whole project" "true"
enum class MyEnum(val i: Int) {
/**
* The first
*/
FIRST: MyEnum(1),
/**
* The second
*/
SECOND: MyEnum(2)<caret>,
/**
* The third
*/
THIRD: MyEnum(3)
}
@@ -1,16 +0,0 @@
// "Change to short enum entry super constructor in the whole project" "true"
enum class MyEnum(val i: Int) {
/**
* The first
*/
FIRST(1),
/**
* The second
*/
SECOND(2),
/**
* The third
*/
THIRD(3)
}
@@ -1,13 +0,0 @@
// "Change to short enum entry super constructor in the whole project" "true"
enum class MyEnum(val i: Int) {
// The
// first
FIRST: MyEnum(1),
// The
// second
SECOND: MyEnum(2),
// The
// third
THIRD: MyEnum(3)<caret>
}
@@ -1,13 +0,0 @@
// "Change to short enum entry super constructor in the whole project" "true"
enum class MyEnum(val i: Int) {
// The
// first
FIRST(1),
// The
// second
SECOND(2),
// The
// third
THIRD(3)
}
@@ -1,5 +0,0 @@
// "Change to short enum entry super constructor" "true"
enum class SimpleEnum(val z: String) {
UNIQUE: SimpleEnum("42")<caret>
}
@@ -1,5 +0,0 @@
// "Change to short enum entry super constructor" "true"
enum class SimpleEnum(val z: String) {
UNIQUE("42")
}
@@ -1,24 +0,0 @@
// "Change to short enum entry super constructor in the whole project" "true"
enum class First(val colorCode: Int) {
RED: First(0xff0000),
GREEN: First(0x00ff00)<caret>, BLUE: First(0x0000ff)
}
enum class Second(val dirCode: Int) {
NORTH: Second(1) {
override fun dir(): String = "N"
},
SOUTH: Second(2) {
override fun dir(): String = "S"
},
WEST : Second(3) {
override fun dir(): String = "W"
},
EAST: Second(4) {
override fun dir(): String = "E"
};
abstract fun dir(): String
}
@@ -1,24 +0,0 @@
// "Change to short enum entry super constructor in the whole project" "true"
enum class First(val colorCode: Int) {
RED(0xff0000),
GREEN(0x00ff00), BLUE(0x0000ff)
}
enum class Second(val dirCode: Int) {
NORTH(1) {
override fun dir(): String = "N"
},
SOUTH(2) {
override fun dir(): String = "S"
},
WEST(3) {
override fun dir(): String = "W"
},
EAST(4) {
override fun dir(): String = "E"
};
abstract fun dir(): String
}
@@ -1,9 +0,0 @@
// "Change to short enum entry super constructor" "true"
enum class SimpleEnum(val z: String = "xxx") {
FIRST(),
SECOND: SimpleEnum("42")<caret>,
LAST("13");
fun foo() = z
}
@@ -1,9 +0,0 @@
// "Change to short enum entry super constructor" "true"
enum class SimpleEnum(val z: String = "xxx") {
FIRST(),
SECOND("42"),
LAST("13");
fun foo() = z
}
@@ -1,9 +0,0 @@
// "Change to short enum entry super constructor" "true"
enum class SimpleEnum(val z: String = "xxx") {
FIRST(),
SECOND: SimpleEnum(z = "42")<caret>,
LAST("13");
fun foo() = z
}
@@ -1,9 +0,0 @@
// "Change to short enum entry super constructor" "true"
enum class SimpleEnum(val z: String = "xxx") {
FIRST(),
SECOND(z = "42")<caret>,
LAST("13");
fun foo() = z
}
@@ -1,13 +0,0 @@
// "Change to short enum entry super constructor" "true"
enum class SimpleEnum(val z: String = "xxx") {
FIRST: SimpleEnum()<caret> {
override fun foo(): String = "abc"
},
SECOND() {
override fun foo(): String = "xyz"
},
LAST("13");
open fun foo(): String = z
}
@@ -1,13 +0,0 @@
// "Change to short enum entry super constructor" "true"
enum class SimpleEnum(val z: String = "xxx") {
FIRST() {
override fun foo(): String = "abc"
},
SECOND() {
override fun foo(): String = "xyz"
},
LAST("13");
open fun foo(): String = z
}
@@ -1,7 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST,
SECOND<caret>,
val zzz = 42
}
@@ -1,7 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST,
SECOND;
val zzz = 42
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
A, B; C<caret> D,
fun foo() = 42
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
A, B, C<caret>, D;
fun foo() = 42
}
@@ -1,9 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST SECOND,
THIRD
FOURTH<caret> FIFTH SIXTH,
SEVENTH EIGHTH
}
@@ -1,9 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST, SECOND,
THIRD,
FOURTH, FIFTH, SIXTH,
SEVENTH, EIGHTH
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST<caret> SECOND
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST, SECOND
}
@@ -1,8 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST<caret>
/* The first one */
SECOND
/* The last one */
}
@@ -1,8 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST<caret>,
/* The first one */
SECOND
/* The last one */
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST<caret> /* The first one */
SECOND
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST, /* The first one */
SECOND
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST<caret> // The first one
SECOND
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST, // The first one
SECOND
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST<caret> /* The first one */ // It's really important
SECOND
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST, /* The first one */ // It's really important
SECOND
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
A B C D<caret> E F G H I J
fun foo() = 42
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
A, B, C, D, E, F, G, H, I, J;
fun foo() = 42
}
@@ -1,8 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum(val z: Int) {
A: MyEnum(3)
B<caret>: MyEnum(7)
C: MyEnum(12)
fun foo() = z * 2
}
@@ -1,8 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum(val z: Int) {
A: MyEnum(3),
B: MyEnum(7),
C: MyEnum(12);
fun foo() = z * 2
}
@@ -1,11 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
A {
override fun foo(): Int = 13
}
B C<caret> {
override fun foo(): Int = 23
}
open fun foo(): Int = 42
}
@@ -1,11 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
A {
override fun foo(): Int = 13
},
B, C<caret> {
override fun foo(): Int = 23
};
open fun foo(): Int = 42
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum(val z: Int) {
A(3) B<caret>(7) C(12)
fun foo() = z * 2
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum(val z: Int) {
A(3), B(7), C(12);
fun foo() = z * 2
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST, SECOND<caret>
val zzz = 42
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST, SECOND;
val zzz = 42
}
@@ -1,7 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST, SECOND<caret>
/* The last one*/
fun foo() = 1
}
@@ -1,7 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
FIRST, SECOND<caret>;
/* The last one*/
fun foo() = 1
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
A<caret>; B; C; D;
fun foo() = 42
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
A<caret>, B, C, D;
fun foo() = 42
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
A; B; C<caret>; D
fun foo() = 42
}
@@ -1,6 +0,0 @@
// "Insert lacking comma(s) / semicolon(s)" "true"
enum class MyEnum {
A, B, C<caret>, D;
fun foo() = 42
}
@@ -1,22 +0,0 @@
// "Insert lacking comma(s) / semicolon(s) in the whole project" "true"
enum class First {
RED GREEN,
BLUE
}
enum class Second(val code: Int) {
NORTH(2) SOUTH(4),
EAST(6) WEST(8)
}
enum class Third {
OK {
override fun diag(): String = "OK"
}
ERROR<caret> {
override fun diag(): String = "Failed"
}
open fun diag(): String = ""
}
@@ -1,22 +0,0 @@
// "Insert lacking comma(s) / semicolon(s) in the whole project" "true"
enum class First {
RED, GREEN,
BLUE
}
enum class Second(val code: Int) {
NORTH(2), SOUTH(4),
EAST(6), WEST(8)
}
enum class Third {
OK {
override fun diag(): String = "OK"
},
ERROR {
override fun diag(): String = "Failed"
};
open fun diag(): String = ""
}