bcfafc601e
This change allows to revert adding `WITH_STDLIB` directive to tests which happened at `a9343aeb`. Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>
21 lines
474 B
Kotlin
Vendored
21 lines
474 B
Kotlin
Vendored
// KT-4423 Enum with function not compiled
|
|
// SKIP_MANGLE_VERIFICATION
|
|
|
|
enum class Sign(val str: String, val func: (x: Int, y: Int) -> Int){
|
|
plus("+", { x, y -> x + y }),
|
|
|
|
mult("*", { x, y -> x * y }) {
|
|
override fun toString() = "${func(4,5)}"
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
val sum = Sign.plus.func(2, 3)
|
|
if (sum != 5) return "Fail 1: $sum"
|
|
|
|
val product = Sign.mult.toString()
|
|
if (product != "20") return "Fail 2: $product"
|
|
|
|
return "OK"
|
|
}
|