Working on bindings in ifs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
fun test() {
|
||||
if (1 is Int) {
|
||||
if (<warning>1 is Boolean</warning>) {
|
||||
if (1 is <error>Boolean</error>) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,4 +75,14 @@ fun f12(a : A?) {
|
||||
is val c is C => <info descr="Automatically cast to C">a</info>.bar()
|
||||
else => a?.foo()
|
||||
}
|
||||
|
||||
if (a is val b) {
|
||||
a?.<error>bar</error>()
|
||||
b?.foo()
|
||||
}
|
||||
if (a is val b is B) {
|
||||
b.foo()
|
||||
<info descr="Automatically cast to B">a</info>.bar()
|
||||
<info descr="Automatically cast to B">b</info>.bar()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
fun test() {
|
||||
val a : Any? = null
|
||||
if (a is Any) else a = null;
|
||||
while (a is Any) a = null
|
||||
while (true) a = null
|
||||
}
|
||||
Reference in New Issue
Block a user