[FIR JS] Prepare the test data for FIR

This commit is contained in:
Nikolay Lunyak
2023-01-03 13:24:08 +02:00
committed by Space Team
parent 0e38d0ebd2
commit 73c89a5d9d
181 changed files with 3790 additions and 10 deletions
@@ -0,0 +1,29 @@
// MODULE: m1
// FILE: a.kt
package foo
import kotlin.js.*
@JsModule("A")
external object A {
fun f(): Int
val g: Int
}
@JsNonModule
external open class B {
fun foo(): Int
}
// MODULE: m2(m1)
// MODULE_KIND: UMD
// FILE: c.kt
package bar
import foo.*
fun box() {
A.f()+A.g
B()
}
@@ -0,0 +1,5 @@
inline fun <T, reified K> bar() {}
fun foo() {
<!INAPPLICABLE_CANDIDATE!>bar<!><Int>()
}
@@ -0,0 +1,9 @@
@file:JsModule("lib")
class A {
class B
fun bar() {}
}
fun foo() = "OK"
@@ -0,0 +1,9 @@
// !DIAGNOSTICS: -NO_VALUE_FOR_PARAMETER, -CONSTANT_EXPECTED_TYPE_MISMATCH
// This should not crash
package foo
@JsModule
external fun foo(x: Int): Int
@JsModule(<!ARGUMENT_TYPE_MISMATCH!>23<!>)
external fun bar(x: Int): Int
@@ -0,0 +1,7 @@
package foo
@JsModule("bar")
external var bar: Int = definedExternally
@JsNonModule
external var baz: Int = definedExternally
@@ -0,0 +1,19 @@
@file:JsModule("foo")
package foo
@JsModule("A")
external class A {
class Nested
}
@JsModule("B")
external object B
@JsModule("foo")
external fun foo(): Int
@JsModule("bar")
external val bar: Int
@JsNonModule
external val baz: Int
@@ -0,0 +1,16 @@
package foo
@JsModule("A")
class A
@JsModule("B")
object B
@JsModule("foo")
fun foo() = 23
@JsModule("bar")
val bar = 42
@JsNonModule
val baz = 99
@@ -0,0 +1,61 @@
// MODULE: m1
// FILE: a.kt
package foo
import kotlin.js.*
@JsModule("A")
external object A {
fun f(): Int
val g: Int
}
@JsModule("B")
external open class B {
fun foo(): Int
class Nested
}
@JsModule("bar")
external fun bar(): Unit
// MODULE: m2(m1)
// FILE: b.kt
// TODO: it's hard to test @JsNonModule on file from an external module
@file:JsModule("foo")
package foo
external fun baz(): Unit
// FILE: c.kt
package bar
import foo.*
fun box() {
A.f()+A.g
B()
bar()
baz()
println(::bar.name)
println(::baz.name)
println(A::f.name)
B.Nested()
boo<B?>(null)
boo(null as B?)
boo<B.Nested?>(null)
println(B::class)
println(B.Nested::class)
}
external class DerivedB : B
inline fun <reified T> boo(x: T) {
println("${T::class.simpleName}: $x")
}
@@ -0,0 +1,53 @@
// MODULE: m1
// FILE: a.kt
package foo
import kotlin.js.*
@JsNonModule
external object A {
fun f(): Int
val g: Int
}
@JsNonModule
external open class B {
fun foo(): Int
class Nested
}
@JsNonModule
external fun bar(): Unit
// MODULE: m2(m1)
// MODULE_KIND: AMD
// TODO: it's hard to test @JsNonModule on file from an external module
// FILE: c.kt
package bar
import foo.*
fun box() {
A.f()+A.g
B()
bar()
B.Nested()
println(::bar.name)
println(A::f.name)
boo<B?>(null)
boo(null as B?)
boo<B.Nested?>(null)
println(B::class)
println(B.Nested::class)
}
external class DerivedB : B
inline fun <reified T> boo(x: T) {
println("${T::class.simpleName}: $x")
}