Skip to content

Commit

Permalink
Add tests for KT-48180
Browse files Browse the repository at this point in the history
  • Loading branch information
pyos authored and Space committed Aug 19, 2021
1 parent dd653ae commit 457420d
Show file tree
Hide file tree
Showing 13 changed files with 213 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// NO_CHECK_LAMBDA_INLINING
// FILE: 1.kt
package test

inline fun foo(x: () -> String, y: () -> String, z: () -> String = { "" }) =
x() + y() + z()


// FILE: 2.kt
import test.*

fun box(): String = foo("O"::toString, { "K" })
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// NO_CHECK_LAMBDA_INLINING
// FILE: 1.kt
package test

inline fun foo(unused: Long, x: () -> String, y: () -> String, z: () -> String = { "" }) =
x() + y() + z()


// FILE: 2.kt
import test.*

fun box(): String {
val O = "O"
return foo(1L, { O }, { "K" })
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// NO_CHECK_LAMBDA_INLINING
// FILE: 1.kt
package test

// This reproduces KT-48180 without captures in the old backend.
// 0 1 2 3 4
inline fun foo(a: Int, b: () -> String, c: () -> String = { "K" }, d: Int = 1, e: Long = 1L) =
b() + c()

// FILE: 2.kt
import test.*

// This is why we can't compute offsets while generating arguments:
// 0 2 [3 is c] 4 5
fun box() = foo(e = 2L, b = { "O" }, d = 1, a = 1)

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 457420d

Please sign in to comment.