Quick fix "add when remaining branches" refactoring + enum / sealed generated name w/o package name

This commit is contained in:
Mikhail Glukhikh
2016-01-12 15:24:23 +03:00
parent 0a3631db6a
commit c3cce53aa2
13 changed files with 58 additions and 39 deletions
@@ -1,4 +1,5 @@
// "Add remaining branches" "true"
// ERROR: Unresolved reference: TODO
fun test(b: Boolean) = wh<caret>en(b) {
false -> 0
}
@@ -1,5 +1,6 @@
// "Add remaining branches" "true"
// ERROR: Unresolved reference: TODO
fun test(b: Boolean) = when(b) {
false -> 0
true -> throw AssertionError("")
true -> TODO()
}
@@ -1,4 +1,6 @@
// "Add remaining branches" "true"
// ERROR: Unresolved reference: TODO
// ERROR: Unresolved reference: TODO
enum class Color { R, G, B }
fun test(c: Color) = wh<caret>en(c) {
Color.B -> 0xff
@@ -1,7 +1,9 @@
// "Add remaining branches" "true"
// ERROR: Unresolved reference: TODO
// ERROR: Unresolved reference: TODO
enum class Color { R, G, B }
fun test(c: Color) = when(c) {
Color.B -> 0xff
Color.R -> throw AssertionError("")
Color.G -> throw AssertionError("")
Color.R -> TODO()
Color.G -> TODO()
}
@@ -0,0 +1,8 @@
// "Add remaining branches" "true"
// ERROR: Unresolved reference: TODO
// ERROR: Unresolved reference: TODO
package test
enum class Color { R, G, B }
fun test(c: Color) = wh<caret>en(c) {
Color.B -> 0xff
}
@@ -0,0 +1,10 @@
// "Add remaining branches" "true"
// ERROR: Unresolved reference: TODO
// ERROR: Unresolved reference: TODO
package test
enum class Color { R, G, B }
fun test(c: Color) = when(c) {
Color.B -> 0xff
Color.R -> TODO()
Color.G -> TODO()
}
@@ -1,4 +1,7 @@
// "Add remaining branches" "true"
// ERROR: Unresolved reference: TODO
// ERROR: Unresolved reference: TODO
// ERROR: Unresolved reference: TODO
sealed class Variant {
object Singleton : Variant()
@@ -1,4 +1,7 @@
// "Add remaining branches" "true"
// ERROR: Unresolved reference: TODO
// ERROR: Unresolved reference: TODO
// ERROR: Unresolved reference: TODO
sealed class Variant {
object Singleton : Variant()
@@ -8,7 +11,7 @@ sealed class Variant {
}
fun test(v: Variant?) = when(v) {
Variant.Singleton -> "s"
is Variant.Something -> throw AssertionError("")
Variant.Another -> throw AssertionError("")
null -> throw AssertionError("")
is Variant.Something -> TODO()
Variant.Another -> TODO()
null -> TODO()
}