5a49ccac76
Previously, resolved call is expected to have SAM converted argument map if SamConversionPerArgument is enabled. However, if SAM argument is followed by vararg parameter and an array _without_ a spread operator is passed, New Inference left a type mismatch error on a resolved call, which made that resolved candidate filtered out. Instead, another resolution result wihtout SAM converted arugment map will be provided. All other logics, such as adding SAM conversion type op and lowering SAM conversion and/or call references, are already there for resolved calls without SAM converted argument map. This change just relaxes the bailout condition so that array passed to vararg after SAM argument can be handled in JVM IR.
53 lines
1.3 KiB
Kotlin
Vendored
53 lines
1.3 KiB
Kotlin
Vendored
// !LANGUAGE: +NewInference +SamConversionForKotlinFunctions +SamConversionPerArgument
|
|
// IGNORE_BACKEND_FIR: JVM_IR
|
|
// TARGET_BACKEND: JVM
|
|
|
|
// FILE: Test.java
|
|
public class Test {
|
|
public static String foo1(Runnable r, String... strs) {
|
|
return null;
|
|
}
|
|
public String foo2(Runnable r1, Runnable r2, String... strs) {
|
|
return null;
|
|
}
|
|
public Test(Runnable r, String... strs) {}
|
|
public Test(Runnable r1, Runnable r2, String... strs) {}
|
|
}
|
|
|
|
// FILE: main.kt
|
|
fun box(): String {
|
|
val x1 = {}
|
|
val x2: Runnable = Runnable { }
|
|
val x3 = arrayOf<String>()
|
|
|
|
Test.foo1({}, arrayOf())
|
|
Test.foo1({}, *arrayOf())
|
|
Test.foo1({}, x3)
|
|
Test.foo1({}, *arrayOf(""))
|
|
|
|
Test.foo1(x1, arrayOf())
|
|
Test.foo1(x1, *arrayOf())
|
|
Test.foo1(x2, *arrayOf())
|
|
|
|
Test.foo1(x1, x3)
|
|
Test.foo1(x1, *x3)
|
|
Test.foo1(x2, *arrayOf(""))
|
|
|
|
val i1 = Test({}, arrayOf())
|
|
val i2 = Test({}, *arrayOf())
|
|
val i3 = Test({}, x3)
|
|
val i4 = Test({}, arrayOf(""))
|
|
val i5 = Test({}, {}, *arrayOf(""))
|
|
val i6 = Test({}, {}, arrayOf())
|
|
|
|
i1.foo2({}, {}, arrayOf())
|
|
i2.foo2({}, {}, *arrayOf())
|
|
i3.foo2(x2, {}, *arrayOf())
|
|
|
|
i4.foo2({}, {}, arrayOf(""))
|
|
i5.foo2({}, {}, *x3)
|
|
i6.foo2(x2, {}, *arrayOf(""))
|
|
|
|
return "OK"
|
|
}
|