diff --git a/compiler/testData/integration/ant/js/simpleWithStdlibAndJsFileAsAnotherLib/build.log.expected b/compiler/testData/integration/ant/js/simpleWithStdlibAndJsFileAsAnotherLib/build.log.expected
new file mode 100644
index 00000000000..c36a7c11434
--- /dev/null
+++ b/compiler/testData/integration/ant/js/simpleWithStdlibAndJsFileAsAnotherLib/build.log.expected
@@ -0,0 +1,13 @@
+OUT:
+Buildfile: [TestData]/build.xml
+
+build:
+ [mkdir] Created dir: [Temp]/lib
+[kotlin2js] Compiling [[TestData]/jslib-example] => [[Temp]/lib/jslib-example.js]
+[kotlin2js] Compiling [[TestData]/root1] => [[Temp]/out.js]
+ [copy] Copying 2 files to [Temp]
+
+BUILD SUCCESSFUL
+Total time: [time]
+
+Return code: 0
diff --git a/compiler/testData/integration/ant/js/simpleWithStdlibAndJsFileAsAnotherLib/build.xml b/compiler/testData/integration/ant/js/simpleWithStdlibAndJsFileAsAnotherLib/build.xml
new file mode 100644
index 00000000000..7c158229d52
--- /dev/null
+++ b/compiler/testData/integration/ant/js/simpleWithStdlibAndJsFileAsAnotherLib/build.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/compiler/testData/integration/ant/js/simpleWithStdlibAndJsFileAsAnotherLib/jslib-example/LibraryExample.kt b/compiler/testData/integration/ant/js/simpleWithStdlibAndJsFileAsAnotherLib/jslib-example/LibraryExample.kt
new file mode 100644
index 00000000000..f77e26551f9
--- /dev/null
+++ b/compiler/testData/integration/ant/js/simpleWithStdlibAndJsFileAsAnotherLib/jslib-example/LibraryExample.kt
@@ -0,0 +1,9 @@
+package library.sample
+
+import kotlin.js.Date
+
+public class ClassA() {
+ val value: Int = 100
+}
+
+public fun Date.extFun(): Int = 100
\ No newline at end of file
diff --git a/compiler/testData/integration/ant/js/simpleWithStdlibAndJsFileAsAnotherLib/root1/foo.kt b/compiler/testData/integration/ant/js/simpleWithStdlibAndJsFileAsAnotherLib/root1/foo.kt
new file mode 100644
index 00000000000..743fab365aa
--- /dev/null
+++ b/compiler/testData/integration/ant/js/simpleWithStdlibAndJsFileAsAnotherLib/root1/foo.kt
@@ -0,0 +1,17 @@
+package foo
+
+import library.sample.*
+import kotlin.js.Date
+
+var ok = "FAIL"
+
+fun main(args: Array) {
+ val x = ClassA().value
+ if (x == 100) {
+ ok = "OK"
+ }
+ val date = Date()
+ println(date.extFun())
+}
+
+fun box(): String = ok
diff --git a/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJsTest.java b/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJsTest.java
index 3fc713efb0d..30e51abf007 100644
--- a/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJsTest.java
+++ b/compiler/tests/org/jetbrains/kotlin/integration/AntTaskJsTest.java
@@ -122,6 +122,11 @@ public class AntTaskJsTest extends AntTaskBaseTest {
doJsAntTest("jslib-example.js");
}
+ @Test
+ public void simpleWithStdlibAndJsFileAsAnotherLib() throws Exception {
+ doJsAntTest("jslib-example.js");
+ }
+
@Test
public void simpleWithMainFQArgs() throws Exception {
doJsAntTest();
diff --git a/libraries/examples/browser-example-with-library/src/main/kotlin/sample/Hello.kt b/libraries/examples/browser-example-with-library/src/main/kotlin/sample/Hello.kt
index c6b0cb65485..6426f005a2f 100644
--- a/libraries/examples/browser-example-with-library/src/main/kotlin/sample/Hello.kt
+++ b/libraries/examples/browser-example-with-library/src/main/kotlin/sample/Hello.kt
@@ -3,6 +3,7 @@ package sample
import kotlin.Pair
import kotlin.browser.document
import library.sample.*
+import kotlin.js.Date
fun myApp() {
val element = document.getElementById("foo")
@@ -11,6 +12,7 @@ fun myApp() {
val x = pairAdd(p)
val y = pairMul(p)
val z = IntHolder(100).value
- element.appendChild(document.createTextNode("x=$x y=$y z=$z")!!)
+ val u = Date().extFun()
+ element.appendChild(document.createTextNode("x=$x y=$y z=$z u=$u")!!)
}
}
diff --git a/libraries/examples/browser-example-with-library/src/test/kotlin/sample/SampleTest.kt b/libraries/examples/browser-example-with-library/src/test/kotlin/sample/SampleTest.kt
index 4cb5a451d97..756573911a2 100644
--- a/libraries/examples/browser-example-with-library/src/test/kotlin/sample/SampleTest.kt
+++ b/libraries/examples/browser-example-with-library/src/test/kotlin/sample/SampleTest.kt
@@ -17,6 +17,6 @@ open class SampleTest {
val foo = driver.findElement(By.id("foo"))!!
val text = foo.getText() ?: ""
println("Found $foo with text '$text'")
- assertEquals("x=30 y=200 z=100", text.trim())
+ assertEquals("x=30 y=200 z=100 u=1000", text.trim())
}
}
\ No newline at end of file
diff --git a/libraries/examples/kotlin-js-library-example/src/main/kotlin/sample/Main.kt b/libraries/examples/kotlin-js-library-example/src/main/kotlin/sample/Main.kt
index 28569346084..af97787d5c9 100644
--- a/libraries/examples/kotlin-js-library-example/src/main/kotlin/sample/Main.kt
+++ b/libraries/examples/kotlin-js-library-example/src/main/kotlin/sample/Main.kt
@@ -1,8 +1,11 @@
package library.sample
+import kotlin.js.Date
+
public fun pairAdd(p: Pair): Int = p.first + p.second
public fun pairMul(p: Pair): Int = p.first * p.second
public data class IntHolder(val value: Int)
+public fun Date.extFun(): Int = 1000
\ No newline at end of file