Add test on inference with SAM adapter
#KT-12144 Fixed
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// FILE: A.java
|
||||
public class A<K, V> {
|
||||
public void foo(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: BiFunction.java
|
||||
public interface BiFunction<T, U, R> {
|
||||
R apply(T t, U u);
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun main() {
|
||||
val a = A<Int, String>()
|
||||
a.foo(2, BiFunction { k, v -> null })
|
||||
a.foo(2) { k, v -> null } // See KT-12144
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package
|
||||
|
||||
public /*synthesized*/ fun </*0*/ T : kotlin.Any!, /*1*/ U : kotlin.Any!, /*2*/ R : kotlin.Any!> BiFunction(/*0*/ function: (t: T!, u: U!) -> R!): BiFunction<T, U, R>
|
||||
public fun main(): kotlin.Unit
|
||||
|
||||
public open class A</*0*/ K : kotlin.Any!, /*1*/ V : kotlin.Any!> {
|
||||
public constructor A</*0*/ K : kotlin.Any!, /*1*/ V : kotlin.Any!>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open fun foo(/*0*/ key: K!, /*1*/ remappingFunction: BiFunction<in K!, in V!, out V!>!): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public interface BiFunction</*0*/ T : kotlin.Any!, /*1*/ U : kotlin.Any!, /*2*/ R : kotlin.Any!> {
|
||||
public abstract fun apply(/*0*/ t: T!, /*1*/ u: U!): R!
|
||||
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
|
||||
}
|
||||
@@ -12185,6 +12185,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/sam/enhancedSamConstructor.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("typeInferenceOnSamAdapters.kt")
|
||||
public void testTypeInferenceOnSamAdapters() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/j+k/sam/typeInferenceOnSamAdapters.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/j+k/samByProjectedType")
|
||||
|
||||
Reference in New Issue
Block a user