record smartcast to the most specific type

This commit is contained in:
Svetlana Isakova
2014-01-31 12:55:30 +04:00
parent 9832676701
commit 9063b3803e
2 changed files with 29 additions and 17 deletions
+6 -6
View File
@@ -11,7 +11,7 @@ fun f9(a : A?) {
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
if (a is B) {
<info descr="Automatically cast to B">a</info>.bar()
<info descr="Automatically cast to A">a</info>.foo()
<info descr="Automatically cast to B">a</info>.foo()
}
a<info>?.</info>foo()
a<info>?.</info><error descr="[UNRESOLVED_REFERENCE] Unresolved reference: bar">bar</error>()
@@ -26,7 +26,7 @@ fun f9(a : A?) {
return;
}
<info descr="Automatically cast to B">a</info>.bar()
<info descr="Automatically cast to A">a</info>.foo()
<info descr="Automatically cast to B">a</info>.foo()
}
fun f10(a : A?) {
@@ -80,7 +80,7 @@ fun f12(a : A?) {
fun f13(a : A?) {
if (a is B) {
<info descr="Automatically cast to A">a</info>.foo()
<info descr="Automatically cast to B">a</info>.foo()
<info descr="Automatically cast to B">a</info>.bar()
}
else {
@@ -93,12 +93,12 @@ fun f13(a : A?) {
a<info>?.</info>foo()
}
else {
<info descr="Automatically cast to A">a</info>.foo()
<info descr="Automatically cast to B">a</info>.foo()
}
a<info>?.</info>foo()
if (a is B && <info descr="Automatically cast to A">a</info>.foo() == Unit.VALUE) {
<info descr="Automatically cast to A">a</info>.foo()
if (a is B && <info descr="Automatically cast to B">a</info>.foo() == Unit.VALUE) {
<info descr="Automatically cast to B">a</info>.foo()
<info descr="Automatically cast to B">a</info>.bar()
}
else {