Quick fix for enum entry super constructor syntax fix, together with a set of tests

This commit is contained in:
Mikhail Glukhikh
2015-05-08 18:05:03 +03:00
parent 147bca3d22
commit da3d083dc0
19 changed files with 280 additions and 1 deletions
@@ -0,0 +1,8 @@
// "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
}
@@ -0,0 +1,8 @@
// "Change to short enum entry super constructor" "true"
enum class MyEnum(val z: Int) {
A(3)
B(7)
C(12)
fun foo() = z * 2
}
@@ -0,0 +1,8 @@
// "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
}
@@ -0,0 +1,8 @@
// "Change to short enum entry super constructor" "true"
enum class MyEnum(val z: Int) {
A(3)
B(7)
C(12)
fun foo() = z * 2
}
@@ -0,0 +1,5 @@
// "Change to short enum entry super constructor" "true"
enum class SimpleEnum(val z: String) {
UNIQUE: SimpleEnum("42")<caret>
}
@@ -0,0 +1,5 @@
// "Change to short enum entry super constructor" "true"
enum class SimpleEnum(val z: String) {
UNIQUE("42")
}
@@ -0,0 +1,24 @@
// "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
}
@@ -0,0 +1,24 @@
// "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
}
@@ -0,0 +1,9 @@
// "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
}
@@ -0,0 +1,9 @@
// "Change to short enum entry super constructor" "true"
enum class SimpleEnum(val z: String = "xxx") {
FIRST(),
SECOND("42"),
LAST("13");
fun foo() = z
}
@@ -0,0 +1,9 @@
// "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
}
@@ -0,0 +1,9 @@
// "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
}
@@ -0,0 +1,13 @@
// "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
}
@@ -0,0 +1,13 @@
// "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
}