Bindings are propagated over control flow, only directly, otherwise it is confusing

This commit is contained in:
Andrey Breslav
2011-06-14 18:48:27 +04:00
parent 79d3f318b9
commit 400e939c21
2 changed files with 66 additions and 95 deletions
+17 -13
View File
@@ -117,29 +117,33 @@ fun f13(a : A?) {
<error>c</error>.bar()
}
// a?.foo()
// if ((a is val c is B) || (a is val c is A)) {
// c.foo()
// c.bar()
// }
// else {
// a?.foo()
// c.bar()
// }
if (!(a is val c is B) || !(a is val x is C)) {
<error>x</error>
<error>c</error>
}
else {
<info descr="Automatically cast to C">x</info>.bar()
<info descr="Automatically cast to B">c</info>.bar()
}
if (!(a is val <error>c</error> is B) || !(a is val <error>c</error> is C)) {
}
if (!(a is val c is B)) return
<info descr="Automatically cast to B">a</info>.bar()
c.foo()
<info descr="Automatically cast to B">c</info>.bar()
<error>c</error>.foo()
<error>c</error>.bar()
}
fun f14(a : A?) {
while (!(a is val c is B)) {
}
<info descr="Automatically cast to B">c</info>.bar()
<info descr="Automatically cast to B">a</info>.bar()
<error>c</error>.bar()
}
fun f15(a : A?) {
do {
} while (!(a is val c is B))
<info descr="Automatically cast to B">c</info>.bar()
<info descr="Automatically cast to B">a</info>.bar()
<error>c</error>.bar()
}