Files
kotlin-fork/compiler/testData/diagnostics/tests/samConversions/OverloadPriority.kt
T
Dmitriy Novozhilov e6b5cb5216 [TD] Update diagnostics test data due to new test runners
Update includes:
- Changing syntax of `OI/`NI` tags from `<!NI;TAG!>` to `<!TAG{NI}!>`
- Fix some incorrect directives
- Change order of diagnostics in some places
- Remove ignored diagnostics from FIR test data (previously `DIAGNOSTICS` didn't work)
- Update FIR dumps in some places and add `FIR_IDENTICAL` if needed
- Replace all JAVAC_SKIP with SKIP_JAVAC directive
2020-12-16 19:52:25 +03:00

32 lines
1.1 KiB
Kotlin
Vendored

// !LANGUAGE: +NewInference
// !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.foo({ it checkType { _<Any>() }; "" }, "") checkType { _<Int>() }
j.bas({ it checkType { _<Any>() }; "" }, "") checkType { _<Int>() }
// NI: TODO
j.<!OVERLOAD_RESOLUTION_AMBIGUITY!>bar<!> { <!UNRESOLVED_REFERENCE!>it<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Any>() }; "" } <!DEBUG_INFO_MISSING_UNRESOLVED!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
}