[FIR] Support CHECK_TYPE in K2 JS tests

^KT-60056
This commit is contained in:
Nikolay Lunyak
2024-01-04 12:39:41 +02:00
committed by Space Team
parent 69fba8d33b
commit f52648af5f
5 changed files with 4 additions and 57 deletions
@@ -1,34 +0,0 @@
// !DIAGNOSTICS: -UNUSED_ANONYMOUS_PARAMETER
// !CHECK_TYPE
fun test(d: dynamic) {
d.foo {}
d.foo { <!UNRESOLVED_REFERENCE!>it<!> }
d.foo { x -> x.bar() }
d.foo { x: Int -> "" }
d.foo { x, y -> "" }
d.foo { x: String, y: Int -> "" }
d.foo { x, y: Int -> "" }
d.foo({})
d.foo({ x -> })
d.foo(<!UNRESOLVED_REFERENCE!>checkSubtype<!><(Int) -> Unit>({ x -> }))
d.foo(label@ { x -> })
d.foo(label@ ({ x, y -> }))
d.foo((label@ ({ x, y: Int -> })))
d.foo(({ x -> }))
d.foo((({ x -> })))
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_ANONYMOUS_PARAMETER
// !CHECK_TYPE
@@ -1,23 +0,0 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun dyn(d: dynamic) {}
fun foo(d: dynamic): String = ""
fun foo(d: Int): Int = 1
fun nothing(d: dynamic): Int = 1
fun nothing(d: Nothing): String = ""
fun test(d: dynamic) {
dyn(1)
dyn("")
foo(1).<!UNRESOLVED_REFERENCE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
foo("").<!UNRESOLVED_REFERENCE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
// Checking specificity of `dynamic` vs `Nothing`
nothing(d).<!UNRESOLVED_REFERENCE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
nothing("").<!UNRESOLVED_REFERENCE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
@Suppress("UNREACHABLE_CODE") nothing(null!!).<!UNRESOLVED_REFERENCE!>checkType<!> { <!UNRESOLVED_REFERENCE!>_<!><String>() }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER