Existing tests updated according to "'Else' is not required in 'when' if Unit is expected"
This commit is contained in:
@@ -14,7 +14,7 @@ fun foo() : Int {
|
||||
//test unreachable code
|
||||
fun fff(): Int {
|
||||
var d = 3
|
||||
<!NO_ELSE_IN_WHEN!>when<!>(d) {
|
||||
when(d) {
|
||||
4 -> 21
|
||||
return 2 -> <!UNREACHABLE_CODE!>return 47<!>
|
||||
<!UNREACHABLE_CODE!>bar() -> 45<!>
|
||||
@@ -23,4 +23,4 @@ fun fff(): Int {
|
||||
return 34
|
||||
}
|
||||
|
||||
fun bar(): Int = 8
|
||||
fun bar(): Int = 8
|
||||
@@ -6,7 +6,7 @@ package kt234_kt973
|
||||
class Pair<A, B>(a: A, b: B)
|
||||
|
||||
fun test(t : Pair<Int, Int>) : Int {
|
||||
<!NO_ELSE_IN_WHEN!>when<!> (t) {
|
||||
when (t) {
|
||||
Pair(10, 10) -> return 1
|
||||
}
|
||||
return 0 // unreachable code
|
||||
@@ -38,4 +38,4 @@ fun foo3(x: Int) = when(x) {
|
||||
fun foo4(x: Int) = when(x) {
|
||||
2 -> x
|
||||
else -> 3
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user