[NI] Avoid type capturing for types that can contain type variables
This commit is contained in:
committed by
Stanislav Erokhin
parent
e040a317cc
commit
08964006de
+14
@@ -0,0 +1,14 @@
|
||||
fun test(i: Inv<out Any?>) {
|
||||
foo(i.superclass())
|
||||
}
|
||||
|
||||
fun <T> foo(x: T) {}
|
||||
|
||||
class Inv<T>
|
||||
|
||||
fun <T> Inv<T>.superclass(): Inv<in T> = Inv()
|
||||
|
||||
fun box(): String {
|
||||
test(Inv())
|
||||
return "OK"
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun foo(useScriptArgs: Array<out Any?>?) {
|
||||
val constructorArgs: Array<out Any?> = arrayOf(useScriptArgs.orEmpty())
|
||||
}
|
||||
|
||||
inline fun <reified T> Array<out T>?.orEmpty(): Array<out T> = this ?: emptyArray<T>()
|
||||
|
||||
fun box(): String {
|
||||
foo(arrayOf(1))
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user