Support type aliases as bare types after 'is/as'.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
typealias L<T> = List<T>
|
||||
typealias NL<T> = List<T>?
|
||||
typealias LStar<<!UNUSED_TYPEALIAS_PARAMETER!>T<!>> = List<*>
|
||||
typealias MyList<<!UNUSED_TYPEALIAS_PARAMETER!>T<!>, X> = List<X>
|
||||
|
||||
fun testL1(x: Collection<Any>) = x is L
|
||||
fun testL2(x: Collection<Int>): List<Int> = x as L
|
||||
fun testL3(x: Collection<Int>?): List<Int>? = x as L?
|
||||
fun testL4(x: Collection<Int>?): List<Int>? = x as? L
|
||||
|
||||
fun testNL1(x: Collection<Int>?): Boolean = x is NL
|
||||
fun testNL2(x: Collection<Int>?): List<Int>? = x as NL
|
||||
fun testNL3(x: Collection<Int>?): List<Int>? = x as NL<!REDUNDANT_NULLABLE!>?<!>
|
||||
|
||||
fun testLStar(x: Collection<Int>): List<Int> = x as LStar
|
||||
fun testMyList(x: Collection<Int>): List<Int> = x as MyList
|
||||
|
||||
typealias MMTT<T> = MutableMap<T, T>
|
||||
typealias Dictionary<T> = MutableMap<String, T>
|
||||
typealias WriteableMap<K, V> = MutableMap<in K, V>
|
||||
typealias ReadableList<T> = MutableList<out T>
|
||||
|
||||
fun testWrong1(x: Map<Any, Any>) = x is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>MMTT<!>
|
||||
fun testWrong2(x: Map<Any, Any>) = x is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>Dictionary<!>
|
||||
fun testWrong3(x: Map<Any, Any>) = x is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>WriteableMap<!>
|
||||
fun testWrong4(x: List<Any>) = x is <!WRONG_NUMBER_OF_TYPE_ARGUMENTS!>ReadableList<!>
|
||||
|
||||
fun <T> testLocal(x: Any) {
|
||||
class C
|
||||
typealias CA = C
|
||||
if (x is <!CANNOT_CHECK_FOR_ERASED!>C<!>) {}
|
||||
if (x is <!CANNOT_CHECK_FOR_ERASED!>CA<!>) {}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package
|
||||
|
||||
public fun testL1(/*0*/ x: kotlin.collections.Collection<kotlin.Any>): kotlin.Boolean
|
||||
public fun testL2(/*0*/ x: kotlin.collections.Collection<kotlin.Int>): kotlin.collections.List<kotlin.Int>
|
||||
public fun testL3(/*0*/ x: kotlin.collections.Collection<kotlin.Int>?): kotlin.collections.List<kotlin.Int>?
|
||||
public fun testL4(/*0*/ x: kotlin.collections.Collection<kotlin.Int>?): kotlin.collections.List<kotlin.Int>?
|
||||
public fun testLStar(/*0*/ x: kotlin.collections.Collection<kotlin.Int>): kotlin.collections.List<kotlin.Int>
|
||||
public fun </*0*/ T> testLocal(/*0*/ x: kotlin.Any): kotlin.Unit
|
||||
public fun testMyList(/*0*/ x: kotlin.collections.Collection<kotlin.Int>): kotlin.collections.List<kotlin.Int>
|
||||
public fun testNL1(/*0*/ x: kotlin.collections.Collection<kotlin.Int>?): kotlin.Boolean
|
||||
public fun testNL2(/*0*/ x: kotlin.collections.Collection<kotlin.Int>?): kotlin.collections.List<kotlin.Int>?
|
||||
public fun testNL3(/*0*/ x: kotlin.collections.Collection<kotlin.Int>?): kotlin.collections.List<kotlin.Int>?
|
||||
public fun testWrong1(/*0*/ x: kotlin.collections.Map<kotlin.Any, kotlin.Any>): kotlin.Boolean
|
||||
public fun testWrong2(/*0*/ x: kotlin.collections.Map<kotlin.Any, kotlin.Any>): kotlin.Boolean
|
||||
public fun testWrong3(/*0*/ x: kotlin.collections.Map<kotlin.Any, kotlin.Any>): kotlin.Boolean
|
||||
public fun testWrong4(/*0*/ x: kotlin.collections.List<kotlin.Any>): kotlin.Boolean
|
||||
public typealias Dictionary</*0*/ T> = kotlin.collections.MutableMap<kotlin.String, T>
|
||||
public typealias L</*0*/ T> = kotlin.collections.List<T>
|
||||
public typealias LStar</*0*/ T> = kotlin.collections.List<*>
|
||||
public typealias MMTT</*0*/ T> = kotlin.collections.MutableMap<T, T>
|
||||
public typealias MyList</*0*/ T, /*1*/ X> = kotlin.collections.List<X>
|
||||
public typealias NL</*0*/ T> = kotlin.collections.List<T>?
|
||||
public typealias ReadableList</*0*/ T> = kotlin.collections.MutableList<out T>
|
||||
public typealias WriteableMap</*0*/ K, /*1*/ V> = kotlin.collections.MutableMap<in K, V>
|
||||
Reference in New Issue
Block a user