Migrate boxInline tests to new multi-file framework
This commit is contained in:
committed by
Alexander Udalov
parent
fa1f7d988e
commit
cc84aabdcf
@@ -1,29 +0,0 @@
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
+35
-1
@@ -1,3 +1,37 @@
|
||||
// FILE: 1.kt
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
|
||||
fun test1(): Int {
|
||||
val inlineX = Inline(9)
|
||||
return inlineX.calcExt(fun(z: Int) = z, 25)
|
||||
@@ -34,4 +68,4 @@ fun box(): String {
|
||||
if (test5() != 20.0) return "test5: ${test5()}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user