bug with incorrect merge of data flow info (KT-104) fixed

This commit is contained in:
svtk
2011-08-22 19:12:22 +04:00
parent 9ebffafd89
commit 3f4f0c8737
2 changed files with 18 additions and 2 deletions
+17 -1
View File
@@ -215,4 +215,20 @@ fun returnFunctionLiteral(a: Any?): Function0<Int> =
fun illegalTupleReturnType(a: Any): (Any, String) = (a, <error>a</error>)
fun declarationInsidePattern(x: (Any, Any)): String = when(x) { is (val a is String, *) => <info descr="Automatically cast to String">a</info>; else => "something" }
fun declarationInsidePattern(x: (Any, Any)): String = when(x) { is (val a is String, *) => <info descr="Automatically cast to String">a</info>; else => "something" }
fun mergeAutocasts(a: Any?) {
if (a is String || a is Int) {
a.<error>compareTo</error>("")
a.toString()
}
if (a is Int || a is String) {
a.<error>compareTo</error>("")
}
when (a) {
is String, is Any => a.<error>compareTo</error>("")
}
if (a is String && a is Any) {
val i: Int = <info descr="Automatically cast to String">a</info>.length
}
}