ff6b3350ae
This lets us properly complete the call which fixes some issues with false-positive type mismatches. This change doesn't apply to array literals in annotation calls yet because they are resolved as context-dependent. This will be adapted in a following commit. #KT-59581
24 lines
538 B
Kotlin
Vendored
24 lines
538 B
Kotlin
Vendored
// !CHECK_TYPE
|
|
// !DIAGNOSTICS: -UNUSED_VARIABLE, -UNSUPPORTED
|
|
|
|
fun test() {
|
|
val a = []
|
|
val b: Array<Int> = []
|
|
val c = [1, 2]
|
|
val d: Array<Int> = [1, 2]
|
|
val e: Array<String> = <!TYPE_MISMATCH, 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 { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Array<Any>>() }
|
|
}
|