Fix inference when captured type is used as a lambda parameter type

Use lower approximation bound to obtain acceptable types for lambda parameters
those types depend on captured type

 #KT-12238 Fixed
 #KT-10627 Fixed
This commit is contained in:
Denis Zharkov
2016-09-19 19:58:55 +03:00
parent cb32bc97dd
commit 4431c6ad02
7 changed files with 104 additions and 1 deletions
@@ -0,0 +1,22 @@
// !CHECK_TYPE
// FILE: A.java
import java.util.function.Consumer;
public class A<T> {
void test(Consumer<? super T> consumer) {}
}
// FILE: 1.kt
import java.util.function.Consumer
fun test(a: A<out Number>) {
a.test (Consumer {
it checkType { _<Number>() }
it.toInt()
})
a.test {
it checkType { _<Number>() }
it.toInt()
}
}