[NI] Map vararg to Array if it's resolved against type variable
While this behavior is questionable, it's consistent with OI and can be changed in future #KT-36201 Fixed
This commit is contained in:
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun foo(vararg ints: Int) {}
|
||||
fun test(i: IntArray) {
|
||||
myLet(i, ::foo)
|
||||
myLet(::foo)
|
||||
<!INAPPLICABLE_CANDIDATE!>myLet<!><Int>(::foo)
|
||||
myLet<IntArray>(::foo)
|
||||
<!INAPPLICABLE_CANDIDATE!>myLetExplicit1<!>(::foo)
|
||||
myLetExplicit2(::foo)
|
||||
}
|
||||
|
||||
fun <T> myLet(t: T, block: (T) -> Unit) {}
|
||||
fun <T> myLet(block: (T) -> Unit) {}
|
||||
fun myLetExplicit1(block: (Int) -> Unit) {}
|
||||
fun myLetExplicit2(block: (IntArray) -> Unit) {}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun foo(vararg ints: Int) {}
|
||||
fun test(i: IntArray) {
|
||||
myLet(i, ::foo)
|
||||
myLet(::foo)
|
||||
myLet<Int>(<!TYPE_MISMATCH!>::foo<!>)
|
||||
myLet<IntArray>(::foo)
|
||||
myLetExplicit1(::foo)
|
||||
myLetExplicit2(::foo)
|
||||
}
|
||||
|
||||
fun <T> myLet(t: T, block: (T) -> Unit) {}
|
||||
fun <T> myLet(block: (T) -> Unit) {}
|
||||
fun myLetExplicit1(block: (Int) -> Unit) {}
|
||||
fun myLetExplicit2(block: (IntArray) -> Unit) {}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ vararg ints: kotlin.Int /*kotlin.IntArray*/): kotlin.Unit
|
||||
public fun </*0*/ T> myLet(/*0*/ block: (T) -> kotlin.Unit): kotlin.Unit
|
||||
public fun </*0*/ T> myLet(/*0*/ t: T, /*1*/ block: (T) -> kotlin.Unit): kotlin.Unit
|
||||
public fun myLetExplicit1(/*0*/ block: (kotlin.Int) -> kotlin.Unit): kotlin.Unit
|
||||
public fun myLetExplicit2(/*0*/ block: (kotlin.IntArray) -> kotlin.Unit): kotlin.Unit
|
||||
public fun test(/*0*/ i: kotlin.IntArray): kotlin.Unit
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun <A1> fun2(f: kotlin.reflect.KFunction1<A1, Unit>, a: A1) {
|
||||
f.invoke(a)
|
||||
}
|
||||
|
||||
fun containsRegex(vararg otherPatterns: String) {}
|
||||
|
||||
fun main() {
|
||||
fun2(::containsRegex, arrayOf("foo"))
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
fun <A1> fun2(f: kotlin.reflect.KFunction1<A1, Unit>, a: A1) {
|
||||
f.invoke(a)
|
||||
}
|
||||
|
||||
fun containsRegex(vararg otherPatterns: String) {}
|
||||
|
||||
fun main() {
|
||||
fun2(::containsRegex, arrayOf("foo"))
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package
|
||||
|
||||
public fun containsRegex(/*0*/ vararg otherPatterns: kotlin.String /*kotlin.Array<out kotlin.String>*/): kotlin.Unit
|
||||
public fun </*0*/ A1> fun2(/*0*/ f: kotlin.reflect.KFunction1<A1, kotlin.Unit>, /*1*/ a: A1): kotlin.Unit
|
||||
public fun main(): kotlin.Unit
|
||||
Reference in New Issue
Block a user