Constraint incorporation

In a constraint system a new bound is incorporated:
all new constrains that can be derived from it
(and from existing ones) are added
This commit is contained in:
Svetlana Isakova
2015-06-27 13:49:11 +03:00
parent 82acce4767
commit 9a5abf368f
30 changed files with 531 additions and 225 deletions
@@ -7,6 +7,6 @@ fun <T, C: Collection<T>> convert(src: Collection<T>, dest: C): C = throw Except
fun test(l: List<Int>) {
//todo should be inferred
val r = <!TYPE_INFERENCE_UPPER_BOUND_VIOLATED!>convert<!>(l, <!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>HashSet<!>())
checkSubtype<Int>(<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>r<!>)
val r = convert(l, HashSet())
checkSubtype<Collection<Int>>(r)
}
@@ -29,8 +29,7 @@ fun test3() {
fun <T, R: T> emptyStrangeMap1(t: T): Map<T, R> = throw Exception("$t")
fun test4() {
//todo we may infer 'Int' for 'R' here
<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>emptyStrangeMap1<!>(1)
emptyStrangeMap1(1)
}
//--------------
@@ -38,8 +37,7 @@ fun test4() {
fun <T: A, R: T> emptyStrangeMap2(t: T): Map<T, R> where R: A = throw Exception("$t")
fun test5(a: A) {
//todo we may infer 'A' for 'R' here
<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>emptyStrangeMap2<!>(a)
emptyStrangeMap2(a)
}
//--------------