TESTS: new tests added
This commit is contained in:
@@ -1027,3 +1027,18 @@ task inline9(type: RunKonanTest) {
|
|||||||
task vararg0(type: RunKonanTest) {
|
task vararg0(type: RunKonanTest) {
|
||||||
source = "lower/vararg.kt"
|
source = "lower/vararg.kt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task inline6(type: RunKonanTest) {
|
||||||
|
goldValue = "hello1\nhello2\nhello3\nhello4\n"
|
||||||
|
source = "codegen/inline/inline6.kt"
|
||||||
|
}
|
||||||
|
|
||||||
|
task inline7(type: RunKonanTest) {
|
||||||
|
goldValue = "1\n2\n3\n"
|
||||||
|
source = "codegen/inline/inline7.kt"
|
||||||
|
}
|
||||||
|
|
||||||
|
task inline8(type: RunKonanTest) {
|
||||||
|
goldValue = "5\n"
|
||||||
|
source = "codegen/inline/inline8.kt"
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
//@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
//inline fun foo(body: () -> Unit) {
|
inline fun foo(body: () -> Unit) {
|
||||||
fun foo(body: () -> Unit) {
|
println("hello1")
|
||||||
body()
|
body()
|
||||||
|
println("hello4")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun bar() {
|
fun bar() {
|
||||||
foo {
|
foo {
|
||||||
println("hello")
|
println("hello2")
|
||||||
|
println("hello3")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
|
inline fun foo(vararg args: Int) {
|
||||||
|
for (a in args) {
|
||||||
|
println(a.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bar() {
|
||||||
|
foo(1, 2, 3)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
bar()
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
|
inline fun foo(i3: Int, i4: Int) : Int {
|
||||||
|
return i3 + i3 + i4
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bar(i1: Int, i2: Int) : Int {
|
||||||
|
return foo(i1 + i2, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
println(bar(1, 2).toString())
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user