JVM box tests for KT-21092

This commit is contained in:
Dmitry Petrov
2020-12-23 14:39:15 +03:00
committed by TeamCityServer
parent 0841a6b0ea
commit 3f7a776fb8
9 changed files with 128 additions and 0 deletions
@@ -0,0 +1,26 @@
// IGNORE_BACKEND: JVM
// WITH_RUNTIME
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: PROPERTY_REFERENCES
val <T> T.foo get() = 42
class A
inline class Z(val x: Int)
fun box(): String {
val test1 = A::foo.get(A())
if (test1 != 42) throw Exception("test1: $test1")
val test2 = String::foo.get("")
if (test2 != 42) throw Exception("test2: $test2")
val test3 = Int::foo.get(1)
if (test3 != 42) throw Exception("test3: $test3")
val test4 = Z::foo.get(Z(1))
if (test4 != 42) throw Exception("test4: $test4")
return "OK"
}
@@ -0,0 +1,12 @@
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// WITH_RUNTIME
class A<T>(val b: T)
fun box(): String {
val test = A(1).b::javaClass.get().simpleName
if (test != "Integer") throw Exception("test: $test")
return "OK"
}