TESTS: new inline tests added

This commit is contained in:
Konstantin Anisimov
2017-01-19 11:40:18 +07:00
parent 4667714e16
commit 16344218c0
3 changed files with 41 additions and 0 deletions
+10
View File
@@ -904,3 +904,13 @@ task inline3(type: RunKonanTest) {
goldValue = "5\n"
source = "codegen/inline/inline3.kt"
}
task inline4(type: RunKonanTest) {
goldValue = "1\n"
source = "codegen/inline/inline4.kt"
}
//task inline5(type: RunKonanTest) {
// goldValue = "9\n"
// source = "codegen/inline/inline5.kt"
//}
@@ -0,0 +1,16 @@
// @Suppress("NOTHING_TO_INLINE")
fun foo(i4: Int, i5: Int): Int {
try {
return i4 / i5
} catch (e: Exception) {
return i4
}
}
fun bar(i1: Int, i2: Int, i3: Int): Int {
return i1 + foo(i2, i3)
}
fun main(args: Array<String>) {
println(bar(1, 8, 0).toString())
}
@@ -0,0 +1,15 @@
//@Suppress("NOTHING_TO_INLINE")
//inline fun foo(body: () -> Unit) {
fun foo(body: () -> Unit) {
body()
}
fun bar() {
foo {
println("hello")
}
}
fun main(args: Array<String>) {
bar()
}