Files
kotlin/compiler/testData/codegen/boxInline/functionExpression/extension.1.kt
Denis Zharkov 3f6cadf9b7 Change FUNCTION_EXPRESSION_WITH_NAME severity to ERROR
Also drop deprecation related parts and get rid of usages of this `feature` within testData
2015-09-25 08:29:26 +03:00

37 lines
858 B
Kotlin
Vendored

fun test1(): Int {
val inlineX = Inline(9)
return inlineX.calcExt(fun(z: Int) = z, 25)
}
fun test2(): Int {
val inlineX = Inline(9)
return inlineX.calcExt2(fun Int.(): Int = this, 25)
}
fun test3(): Int {
val inlineX = Inline(9)
return inlineX.doWork(InlineX(11))
}
fun test4(): Double {
val inlineX = Inline(9)
return inlineX.doWorkWithDouble(11.0)
}
fun test5(): Double {
val inlineX = Inline(9)
with(inlineX) {
11.0.calcDouble(fun (a: Int, b: Double) = a + b)
}
return inlineX.doWorkWithDouble(11.0)
}
fun box(): String {
if (test1() != 25) return "test1: ${test1()}"
if (test2() != 25) return "test2: ${test2()}"
if (test3() != 20) return "test3: ${test3()}"
if (test4() != 20.0) return "test4: ${test4()}"
if (test5() != 20.0) return "test5: ${test5()}"
return "OK"
}