fun check(expected: String, obj: Any?) { val actual = obj.toString() if (actual != expected) throw AssertionError("Expected: $expected, actual: $actual") } fun box(): String { check("kotlin.jvm.functions.Function0") { -> } check("kotlin.jvm.functions.Function0") { -> 42 } check("kotlin.jvm.functions.Function1", fun (s: String) = 42.toLong()) check("kotlin.jvm.functions.Function2") { x: Int, y: Int -> } check("kotlin.jvm.functions.Function1", fun Int.() {}) check("kotlin.jvm.functions.Function1", fun Unit.(): Int = 42) check("kotlin.jvm.functions.Function2", fun String.(s: String): Long = 42.toLong()) check("kotlin.jvm.functions.Function3", fun Int.(x: Int, y: Int) {}) return "OK" }