mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
In codegen tests on Android, everything is being run with kotlin-reflect in the classpath. So a package is no longer represented by a reflect-less PackageReference, but by a full-blown KPackageImpl. Use a less specific supertype ClassBasedDeclarationContainer instead, the one which is a supertype of both PackageReference and KPackageImpl, and which still allows to get the underlying jClass.
13 lines
351 B
Kotlin
Vendored
13 lines
351 B
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
// IGNORE_BACKEND_FIR: JVM_IR
|
|
// WITH_RUNTIME
|
|
|
|
fun box(): String {
|
|
val f = Any?::toString
|
|
|
|
val owner = (f as kotlin.jvm.internal.CallableReference).owner as kotlin.jvm.internal.ClassBasedDeclarationContainer
|
|
if (owner.jClass.name != "kotlin.jvm.internal.Intrinsics\$Kotlin") return "Fail: $owner"
|
|
|
|
return "OK"
|
|
}
|