[NI] Improve completing callable references with type variable as expected type

#KT-32462 Fixed
This commit is contained in:
Dmitriy Novozhilov
2020-01-15 11:51:53 +03:00
parent 6fe214d825
commit 04ce10b6c1
16 changed files with 233 additions and 40 deletions
@@ -0,0 +1,27 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
// ISSUE: KT-32462
fun <K> select(x: K, y: K): K = x
interface A {
fun toB(): B
fun toC(): C
fun toC(x: Int): C
}
interface B
interface C
fun test_1() {
select(
{ a: A -> a.toB() },
{ a: A -> a.toC() }
)
}
fun test_2() {
select(
A::toB,
<!UNRESOLVED_REFERENCE!>A::toC<!>
)
}
@@ -0,0 +1,27 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
// ISSUE: KT-32462
fun <K> select(x: K, y: K): K = x
interface A {
fun toB(): B
fun toC(): C
fun toC(x: Int): C
}
interface B
interface C
fun test_1() {
<!DEBUG_INFO_EXPRESSION_TYPE("(A) -> kotlin.Any")!>select(
{ a: A -> a.toB() },
{ a: A -> a.toC() }
)<!>
}
fun test_2() {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.reflect.KFunction1<A, kotlin.Any>")!>select(
A::toB,
A::toC
)<!>
}
@@ -0,0 +1,26 @@
package
public fun </*0*/ K> select(/*0*/ x: K, /*1*/ y: K): K
public fun test_1(): kotlin.Unit
public fun test_2(): 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 abstract fun toB(): B
public abstract fun toC(): C
public abstract fun toC(/*0*/ x: kotlin.Int): C
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
}
public interface C {
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
}