Error on 'if' without an 'else' branch when used as an expression
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
fun box(): String {
|
||||
if (true);
|
||||
if (false);
|
||||
val iftrue = if (true);
|
||||
val iffalse = if (false);
|
||||
|
||||
var state = 0
|
||||
val k = if (state++==1);
|
||||
if (state != 1) return "Fail: $state"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
fun box(): String {
|
||||
val a = if(true) {
|
||||
}
|
||||
return if (a.toString() == "kotlin.Unit") "OK" else "fail"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fun foo(condition: Boolean): String {
|
||||
val u = if (condition) {
|
||||
"OK"
|
||||
} else {
|
||||
}
|
||||
return u.toString()
|
||||
}
|
||||
|
||||
fun box() = foo(true)
|
||||
Reference in New Issue
Block a user