Fix non local returns to functional expressions

This commit is contained in:
Michael Bogdanov
2015-04-23 17:15:33 +03:00
parent 012bc8f1db
commit 0854c601b4
7 changed files with 85 additions and 35 deletions
@@ -0,0 +1,29 @@
inline fun Inline.calcExt(s: (Int) -> Int, p: Int) : Int {
return s(p)
}
inline fun Inline.calcExt2(s: Int.() -> Int, p: Int) : Int {
return p.s()
}
class InlineX(val value : Int) {}
class Inline(val res: Int) {
inline fun InlineX.calcInt(s: (Int, Int) -> Int) : Int {
return s(res, this.value)
}
inline fun Double.calcDouble(s: (Int, Double) -> Double) : Double {
return s(res, this)
}
fun doWork(l : InlineX) : Int {
return l.calcInt(fun (a: Int, b: Int) = a + b)
}
fun doWorkWithDouble(s : Double) : Double {
return s.calcDouble(fun (a: Int, b: Double) = a + b)
}
}