[NI] Resolve callable reference eagerly at the end of resolution parts

This way we'll resolve less callable references later as we'll have
 more constraints to clip wrong candidates for callable references
This commit is contained in:
Mikhail Zarechenskiy
2019-04-05 12:39:34 +03:00
parent c3bc6ef2fa
commit ff2ce316e1
10 changed files with 86 additions and 11 deletions
@@ -0,0 +1,16 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
interface A
interface B
fun fooB(b: B) {}
fun <T> bar(f: (T) -> Unit, e: T) {}
fun <T> baz(e: T, f: (T) -> Unit) {}
fun test(a: A, b: B) {
// Note that diagnostic is always on callable references as they are resolved after simple arguments
baz(a, <!TYPE_MISMATCH!>::fooB<!>)
bar(<!TYPE_MISMATCH!>::fooB<!>, a)
}
@@ -0,0 +1,18 @@
package
public fun </*0*/ T> bar(/*0*/ f: (T) -> kotlin.Unit, /*1*/ e: T): kotlin.Unit
public fun </*0*/ T> baz(/*0*/ e: T, /*1*/ f: (T) -> kotlin.Unit): kotlin.Unit
public fun fooB(/*0*/ b: B): kotlin.Unit
public fun test(/*0*/ a: A, /*1*/ b: B): 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 {
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
}