Fix compiler exception during resolution of ambiguous callable references
Function return type can't and should not be used during overload resolution of callable references. Since it can be DeferredType, its substitution in CS caused exception.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
interface G<T> {
|
||||
fun build(): G<T>
|
||||
}
|
||||
class V1<V>(val value: V)
|
||||
class V2<V>(val value: V)
|
||||
fun <V, T : V?> G<T>.foo(vararg values: V1<V>) = build()
|
||||
fun <V, T : V?> G<T>.foo(vararg values: V2<V?>) = build()
|
||||
|
||||
fun forReference(ref: Any?) {}
|
||||
|
||||
fun test() {
|
||||
forReference(G<Int?>::<!NI;CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY, NI;DEBUG_INFO_MISSING_UNRESOLVED, OI;CANNOT_COMPLETE_RESOLVE!>foo<!>)
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package
|
||||
|
||||
public fun forReference(/*0*/ ref: kotlin.Any?): kotlin.Unit
|
||||
public fun test(): kotlin.Unit
|
||||
public fun </*0*/ V, /*1*/ T : V?> G<T>.foo(/*0*/ vararg values: V1<V> /*kotlin.Array<out V1<V>>*/): G<T>
|
||||
public fun </*0*/ V, /*1*/ T : V?> G<T>.foo(/*0*/ vararg values: V2<V?> /*kotlin.Array<out V2<V?>>*/): G<T>
|
||||
|
||||
public interface G</*0*/ T> {
|
||||
public abstract fun build(): G<T>
|
||||
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 final class V1</*0*/ V> {
|
||||
public constructor V1</*0*/ V>(/*0*/ value: V)
|
||||
public final val value: V
|
||||
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 final class V2</*0*/ V> {
|
||||
public constructor V2</*0*/ V>(/*0*/ value: V)
|
||||
public final val value: V
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !LANGUAGE: +NewInference
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
fun foo(s: String) {}
|
||||
fun foo(i: Long) {}
|
||||
|
||||
fun bar(f: (Boolean) -> Unit) {}
|
||||
|
||||
fun test() {
|
||||
bar(::<!NI;CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY, NI;DEBUG_INFO_MISSING_UNRESOLVED, OI;NONE_APPLICABLE!>foo<!>)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package
|
||||
|
||||
public fun bar(/*0*/ f: (kotlin.Boolean) -> kotlin.Unit): kotlin.Unit
|
||||
public fun foo(/*0*/ i: kotlin.Long): kotlin.Unit
|
||||
public fun foo(/*0*/ s: kotlin.String): kotlin.Unit
|
||||
public fun test(): kotlin.Unit
|
||||
Reference in New Issue
Block a user