Prohibit using array based on non-reified type parameters as reified type arguments

#KT-31227 fixed
This commit is contained in:
Ilya Chernikov
2019-11-14 08:22:04 +01:00
parent 8a1f8714e7
commit 27ff2d7816
13 changed files with 131 additions and 16 deletions
@@ -0,0 +1,19 @@
// !LANGUAGE: -ProhibitNonReifiedArraysAsReifiedTypeArguments
// !DIAGNOSTICS: -UNUSED_PARAMETER
inline fun <reified T> foo() {}
fun <T> bar() {
foo<<!TYPE_PARAMETER_AS_REIFIED!>T<!>>()
foo<<!TYPE_PARAMETER_AS_REIFIED_ARRAY_WARNING!>Array<T><!>>()
foo<<!TYPE_PARAMETER_AS_REIFIED_ARRAY_WARNING!>Array<Array<T>><!>>()
foo<Array<Int>>()
foo<Array<Array<Int>>>()
foo<IntArray>()
foo<List<T>>()
foo<List<Array<T>>>()
}
fun test(x: Array<String>, y: Array<*>) {
bar<Int>()
}