DelegationSpecifier resolve depends on expected type (supertype)

This commit is contained in:
Svetlana Isakova
2014-07-19 20:32:37 +04:00
parent e7c285e0e0
commit 8f6f8331ac
10 changed files with 78 additions and 46 deletions
@@ -0,0 +1,25 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
trait A<T> {
fun foo(): Int
}
class AImpl<T>: A<T> {
override fun foo() = 42
}
class B : A<Int> by AImpl()
fun <T> bar(): A<T> = AImpl()
class C : A<Int> by bar()
fun <T> baz(f: (T) -> T): A<T> = AImpl()
class D : A<Int> by baz({ it + 1 })
fun <T> boo(t: T): A<T> = AImpl()
class E : A<Int> by <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>boo<!>("")
class F : A<Int> by <!TYPE_MISMATCH!>AImpl<String>()<!>