mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-12 00:21:32 +00:00
Match the rules from the old backend: 1. Private and inline only methods get package private default argument stubs. 2. Everything else is public.
33 lines
615 B
Kotlin
Vendored
33 lines
615 B
Kotlin
Vendored
// IGNORE_BACKEND_FIR: JVM_IR
|
|
// TARGET_BACKEND: JVM
|
|
|
|
// WITH_REFLECT
|
|
|
|
import kotlin.reflect.full.IllegalCallableAccessException
|
|
import kotlin.reflect.jvm.isAccessible
|
|
|
|
class A {
|
|
private fun foo(default: Any? = this) {
|
|
}
|
|
|
|
fun f() = A::foo
|
|
}
|
|
|
|
fun box(): String {
|
|
val a = A()
|
|
val f = a.f()
|
|
|
|
try {
|
|
f.callBy(mapOf(f.parameters.first() to a))
|
|
return "Fail: IllegalCallableAccessException should have been thrown"
|
|
}
|
|
catch (e: IllegalCallableAccessException) {
|
|
// OK
|
|
}
|
|
|
|
f.isAccessible = true
|
|
f.callBy(mapOf(f.parameters.first() to a))
|
|
|
|
return "OK"
|
|
}
|