Files
kotlin-fork/compiler/testData/codegen/box/callableReference/equality/varargWithDefaults.kt
T
Alexander Udalov 0681231e99 Introduce AdaptedFunctionReference runtime class
It's used as a superclass for anonymous classes for adapted function
references. Its main feature is that it _doesn't_ inherit from KFunction
(as opposed to FunctionReference), as per the decision to postpone
reflection support for adapted function references in KT-36024.

 #KT-36024 Fixed
2020-04-08 19:15:38 +02:00

23 lines
617 B
Kotlin
Vendored

// IGNORE_BACKEND: JS, JS_IR, NATIVE
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: test.kt
fun checkEqual(x: Any, y: Any) {
if (x != y || y != x) throw AssertionError("$x and $y should be equal")
if (x.hashCode() != y.hashCode()) throw AssertionError("$x and $y should have the same hash code")
}
fun target(x: Int = 0, vararg ys: String) {}
fun captureAll1(fn: () -> Unit): Any = fn
fun captureAll2(fn: () -> Unit): Any = fn
fun box(): String {
checkEqual(captureAll1(::target), captureAll2(::target))
return "OK"
}
// FILE: fromOtherFile.kt
fun captureAllFromOtherFile(): Any = captureAll1(::target)