Files
kotlin-fork/compiler/testData/diagnostics/tests/collectionLiterals/basicCollectionLiterals.kt
T
Ilya Chernikov 70c89a28e1 Stop subtyping constraint search if equality constraints for...
all not fixed type vars are found
#KT-35626 fixed
2020-03-12 08:02:45 +01:00

24 lines
711 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNSUPPORTED
fun test() {
val a = <!NI;NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, OI;TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>[]<!>
val b: Array<Int> = []
val c = [1, 2]
val d: Array<Int> = [1, 2]
val e: Array<String> = <!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>[1]<!>
val f: IntArray = [1, 2]
val g = [f]
}
fun check() {
[1, 2] checkType { _<Array<Int>>() }
[""] checkType { _<Array<String>>() }
val f: IntArray = [1]
[f] checkType { _<Array<IntArray>>() }
[1, ""] checkType { <!NI;UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Array<Any>>() }
}