KT-6081 Chained generic method calls: wrong type inference

#KT-6081 Fixed
This commit is contained in:
Svetlana Isakova
2014-11-24 18:10:23 +03:00
parent 9c880de735
commit 724f2e6e7b
12 changed files with 295 additions and 17 deletions
@@ -0,0 +1,25 @@
class Test {
private fun <T : Any> T.self() = object {
fun bar(): T {
return this@self
}
}
fun test() {
1.self().bar() + 1
}
}
class Foo<R> {
private fun <T> bar() = object {
fun baz(): Foo<R> {
return this@Foo
}
}
fun getR(r: R) = r
fun test() {
Foo<Int>().bar<String>().baz().getR(1)
Foo<Int>().bar<String>().baz().getR(<!TYPE_MISMATCH!>""<!>)
}
}