use data flow info in constraint system

intersect data flow value possible types
add intersection type (or exact type for the most cases) as a lower bound to constraint system

always get common super type for intersection type as a result
(avoid returning it, even in error messages)
This commit is contained in:
Svetlana Isakova
2013-07-29 16:32:37 +04:00
parent b91846eb5d
commit 27cff93ed8
7 changed files with 195 additions and 2 deletions
@@ -0,0 +1,19 @@
//KT-2746 Do autocasts in inference
import java.util.HashMap
class C<T>(t :T)
fun test1(a: Any) {
if (a is String) {
val <!UNUSED_VARIABLE!>c<!>: C<String> = C(a)
}
}
fun f<T>(t :T): C<T> = C(t)
fun test2(a: Any) {
if (a is String) {
val <!UNUSED_VARIABLE!>c1<!>: C<String> = f(a)
}
}