Avoid duplication of imports introduced during JS inlining
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
// MODULE: lib
|
||||
// FILE: lib.kt
|
||||
fun foo(x: String) = "foo($x)"
|
||||
|
||||
inline fun bar(x: String) = "bar(${foo(x)})"
|
||||
|
||||
inline fun baz(x: String) = "baz(${foo(x)})"
|
||||
|
||||
// MODULE: main(lib)
|
||||
// FILE: a.kt
|
||||
// PROPERTY_READ_COUNT: name=foo_61zpoe$ count=1
|
||||
fun test1() = bar("q")
|
||||
|
||||
// FILE: b.kt
|
||||
// RECOMPILE
|
||||
fun test2() = baz("w")
|
||||
|
||||
// FILE: main.kt
|
||||
// RECOMPILE
|
||||
fun box(): String {
|
||||
val a = test1()
|
||||
if (a != "bar(foo(q))") return "fail1: $a"
|
||||
|
||||
val b = test2()
|
||||
if (b != "baz(foo(w))") return "fail2: $b"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+1
-1
@@ -17,4 +17,4 @@ fun bar(a: String, b: Char, x: Int) {
|
||||
a.foo(b)
|
||||
}
|
||||
|
||||
// LINES: 6 4 4 5 5 8 8 8 8 8 11 9 9 10 10 18 14 14 14 14 14 15 17 17 9 9 14 10 17 10 14 14 * 1 * 1
|
||||
// LINES: 6 4 4 5 5 8 8 8 8 8 8 8 11 9 9 10 10 8 8 8 8 18 14 14 14 14 14 15 17 17 9 9 14 10 17 10 14 14 * 1 * 1
|
||||
@@ -9,4 +9,4 @@ fun bar() {
|
||||
foo(42)
|
||||
}
|
||||
|
||||
// LINES: 1 1 1 1 1 6 2 2 3 3 4 4 10 2 2 9 2 3 3 4 4
|
||||
// LINES: 1 1 1 1 1 6 2 2 3 3 4 4 1 1 10 2 2 9 2 3 3 4 4
|
||||
+1
-1
@@ -21,4 +21,4 @@ fun bar(x: Int) {
|
||||
println("%")
|
||||
}
|
||||
|
||||
// LINES: 1 1 1 1 1 1 1 17 2 2 3 3 4 7 7 9 9 10 10 11 14 14 16 16 22 20 20 20 20 2 2 3 3 4 3 7 7 9 9 10 10 11 10 14 14 16 16 * 20 21 21
|
||||
// LINES: 1 1 1 1 1 1 1 17 2 2 3 3 4 7 7 9 9 10 10 11 14 14 16 16 1 1 22 20 20 20 20 2 2 3 3 4 3 7 7 9 9 10 10 11 10 14 14 16 16 * 20 21 21
|
||||
Reference in New Issue
Block a user