mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
39 lines
1.6 KiB
Kotlin
Vendored
39 lines
1.6 KiB
Kotlin
Vendored
// TODO: muted automatically, investigate should it be ran for JS or not
|
|
// IGNORE_BACKEND: JS, NATIVE
|
|
|
|
// WITH_REFLECT
|
|
|
|
fun check(expected: String, obj: Any?) {
|
|
val actual = obj.toString()
|
|
if (actual != expected)
|
|
throw AssertionError("Expected: $expected, actual: $actual")
|
|
}
|
|
|
|
fun box(): String {
|
|
check("() -> kotlin.Unit",
|
|
{ -> })
|
|
check("() -> kotlin.Int",
|
|
{ -> 42 })
|
|
check("(kotlin.String) -> kotlin.Long",
|
|
fun (s: String) = 42.toLong())
|
|
check("(kotlin.Int, kotlin.Int) -> kotlin.Unit",
|
|
{ x: Int, y: Int -> })
|
|
|
|
check("kotlin.Int.() -> kotlin.Unit",
|
|
fun Int.() {})
|
|
check("kotlin.Unit.() -> kotlin.Int?",
|
|
fun Unit.(): Int? = 42)
|
|
check("kotlin.String.(kotlin.String?) -> kotlin.Long",
|
|
fun String.(s: String?): Long = 42.toLong())
|
|
check("kotlin.collections.List<kotlin.String>.(kotlin.collections.MutableSet<*>, kotlin.Nothing) -> kotlin.Unit",
|
|
fun List<String>.(x: MutableSet<*>, y: Nothing) {})
|
|
|
|
check("(kotlin.IntArray, kotlin.ByteArray, kotlin.ShortArray, kotlin.CharArray, kotlin.LongArray, kotlin.BooleanArray, kotlin.FloatArray, kotlin.DoubleArray) -> kotlin.Array<kotlin.Int>",
|
|
fun (ia: IntArray, ba: ByteArray, sa: ShortArray, ca: CharArray, la: LongArray, za: BooleanArray, fa: FloatArray, da: DoubleArray): Array<Int> = null!!)
|
|
|
|
check("(kotlin.Array<kotlin.Array<kotlin.Array<kotlin.collections.List<kotlin.String>>>>) -> kotlin.Comparable<kotlin.String>",
|
|
fun (a: Array<Array<Array<List<String>>>>): Comparable<String> = null!!)
|
|
|
|
return "OK"
|
|
}
|