Introduce UnsafeVariance annotation
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
class A<out T, in E> {
|
||||
fun foo(x: @UnsafeVariance T) {}
|
||||
fun foo(x: @UnsafeVariance T, y: List<@UnsafeVariance T>): @UnsafeVariance E = null!!
|
||||
|
||||
fun bar(): List<@UnsafeVariance E> = null!!
|
||||
}
|
||||
|
||||
fun foo(x: A<String, Any?>, cs: CharSequence, ls: List<CharSequence>) {
|
||||
val y: A<CharSequence, String> = x
|
||||
|
||||
y.foo(cs)
|
||||
val s: String = y.foo(cs, ls)
|
||||
|
||||
val ls2: List<String> = y.bar()
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ x: A<kotlin.String, kotlin.Any?>, /*1*/ cs: kotlin.CharSequence, /*2*/ ls: kotlin.List<kotlin.CharSequence>): kotlin.Unit
|
||||
|
||||
public final class A</*0*/ out T, /*1*/ in E> {
|
||||
public constructor A</*0*/ out T, /*1*/ in E>()
|
||||
public final fun bar(): kotlin.List<@kotlin.UnsafeVariance() E>
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public final fun foo(/*0*/ x: @kotlin.UnsafeVariance() T): kotlin.Unit
|
||||
public final fun foo(/*0*/ x: @kotlin.UnsafeVariance() T, /*1*/ y: kotlin.List<@kotlin.UnsafeVariance() T>): @kotlin.UnsafeVariance() E
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Reference in New Issue
Block a user