FIR IDE: add tests about types of array/list and their element

This commit is contained in:
Jinseong Jeon
2021-11-05 13:11:22 -07:00
committed by Ilya Kirillov
parent e1f6c19c83
commit 08e181a543
15 changed files with 114 additions and 1 deletions
@@ -0,0 +1,5 @@
fun foo() {
val arr = arrayOfNulls<List<*>>(10)
arr[0] = emptyList<Any>()
<expr>arr[0]</expr>
}
@@ -0,0 +1,2 @@
expression: arr[0]
type: kotlin.collections.List<*>?
@@ -0,0 +1,4 @@
fun foo() {
val arr = arrayOfNulls<List<*>>(10)
<expr>arr</expr>[0] = emptyList<Any>()
}
@@ -0,0 +1,2 @@
expression: arr
type: kotlin.Array<kotlin.collections.List<*>?>
@@ -0,0 +1,5 @@
// WITH_STDLIB
fun foo() {
val lst = listOf<List<*>>(listOf("A"), listOf(42), emptyList())
<expr>lst[0]</expr>
}
@@ -0,0 +1,2 @@
expression: lst[0]
type: kotlin.collections.List<*>
@@ -0,0 +1,6 @@
// WITH_STDLIB
fun foo() {
val lst = mutableListOf<List<*>>()
lst[0] = emptyList<Any>()
<expr>lst[0]</expr>
}
@@ -0,0 +1,2 @@
expression: lst[0]
type: kotlin.collections.List<*>
@@ -0,0 +1,5 @@
// WITH_STDLIB
fun foo() {
val lst = listOf<List<*>>(listOf("A"), listOf(42), emptyList())
<expr>lst</expr>[0]
}
@@ -0,0 +1,2 @@
expression: lst
type: kotlin.collections.List<kotlin.collections.List<*>>
@@ -0,0 +1,5 @@
// WITH_STDLIB
fun foo() {
val lst = mutableListOf<List<*>>()
<expr>lst</expr>[0] = emptyList<Any>()
}
@@ -0,0 +1,2 @@
expression: lst
type: kotlin.collections.MutableList<kotlin.collections.List<*>>