Working on bindings in ifs

This commit is contained in:
Andrey Breslav
2011-06-13 14:33:32 +04:00
parent c2aceefe76
commit 3cacb512a3
6 changed files with 128 additions and 48 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
fun test() {
if (1 is Int) {
if (<warning>1 is Boolean</warning>) {
if (1 is <error>Boolean</error>) {
}
}
+10
View File
@@ -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
}