Deduce receiver type of callable reference from LHS, not from descriptor

This commit is contained in:
Alexander Udalov
2015-10-15 13:05:55 +03:00
parent 2cf437c0e2
commit bf4a681589
6 changed files with 59 additions and 8 deletions
@@ -0,0 +1,18 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.*
interface A
interface B : A
fun A.foo() {}
fun take(f: (A) -> Unit) {}
fun take(f: () -> Unit) {}
fun test() {
B::foo checkType { _<KFunction1<B, Unit>>() }
<!NONE_APPLICABLE!>take<!>(B::foo)
}
@@ -0,0 +1,18 @@
package
public fun take(/*0*/ f: () -> kotlin.Unit): kotlin.Unit
public fun take(/*0*/ f: (A) -> kotlin.Unit): kotlin.Unit
public fun test(): kotlin.Unit
public fun A.foo(): kotlin.Unit
public interface A {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface B : A {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}