FIR: resolve conflicts around SAM calls properly
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
// !LANGUAGE: +EliminateAmbiguitiesOnInheritedSamInterfaces
|
||||
// !CHECK_TYPE
|
||||
// FILE: Fn.java
|
||||
public interface Fn<T, R> {
|
||||
R apply(T t);
|
||||
}
|
||||
|
||||
// FILE: Fn2.java
|
||||
public interface Fn2<T, R> extends Fn<T, R> {}
|
||||
|
||||
// FILE: J.java
|
||||
public interface J {
|
||||
String foo(Fn<String, Object> f, Object o);
|
||||
int foo(Fn<Object, Object> f, String s); // (Any) -> Any <: (String) -> Any <=> String <: Any
|
||||
|
||||
String bas(Fn<Object, Object> f, Object o);
|
||||
int bas(Fn<Object, String> f, String s); // (Any) -> String <: (Any) -> Any <=> String <: Any
|
||||
|
||||
String bar(Fn<String, Object> f);
|
||||
int bar(Fn2<String, Object> f); // Fn2 seems more specific one even function type same
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
fun test(j: J) {
|
||||
j.<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!>({ <!UNRESOLVED_REFERENCE!>it<!> checkType { _<Any>() }; "" }, "") <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<Int>() }
|
||||
|
||||
j.<!OVERLOAD_RESOLUTION_AMBIGUITY!>bas<!>({ <!UNRESOLVED_REFERENCE!>it<!> checkType { _<Any>() }; "" }, "") <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<Int>() }
|
||||
|
||||
j.bar { it checkType { _<String>() }; "" } checkType { _<Int>() }
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +EliminateAmbiguitiesOnInheritedSamInterfaces
|
||||
// !CHECK_TYPE
|
||||
// FILE: Fn.java
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
// !LANGUAGE: +EliminateAmbiguitiesOnInheritedSamInterfaces +SamConversionForKotlinFunctions +SamConversionPerArgument
|
||||
// !CHECK_TYPE
|
||||
// FILE: Fn.java
|
||||
public interface Fn<T, R> {
|
||||
R apply(T t);
|
||||
}
|
||||
|
||||
// FILE: Fn2.java
|
||||
public interface Fn2<T, R> extends Fn<T, R> {}
|
||||
|
||||
// FILE: 1.kt
|
||||
interface K {
|
||||
fun foo(f: Fn<String, Any>): String
|
||||
fun foo(f: Fn<Any, Any>): Int
|
||||
|
||||
fun bas(f: Fn<Any, Any>): String
|
||||
fun bas(f: Fn<Any, String>): Int
|
||||
|
||||
fun bar(f: Fn<String, Any>): String
|
||||
fun bar(f: Fn2<String, Any>): Int
|
||||
}
|
||||
|
||||
fun test(k: K) {
|
||||
k.<!OVERLOAD_RESOLUTION_AMBIGUITY!>foo<!> { <!UNRESOLVED_REFERENCE!>it<!> checkType { _<Any>() }; "" } <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<Int>() }
|
||||
|
||||
k.<!OVERLOAD_RESOLUTION_AMBIGUITY!>bas<!> { <!UNRESOLVED_REFERENCE!>it<!> checkType { _<Any?>() }; "" } <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>checkType<!> { _<Int>() }
|
||||
|
||||
k.bar { it checkType { _<String>() }; "" } checkType { _<Int>() }
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +EliminateAmbiguitiesOnInheritedSamInterfaces +SamConversionForKotlinFunctions +SamConversionPerArgument
|
||||
// !CHECK_TYPE
|
||||
// FILE: Fn.java
|
||||
|
||||
Reference in New Issue
Block a user