JS: add constructor binding and inlining test
This commit is contained in:
+5
@@ -5940,6 +5940,11 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/nameClashes/constructorLocalVar.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("constructorsCrossFile.kt")
|
||||
public void testConstructorsCrossFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/nameClashes/constructorsCrossFile.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("differenceInCapitalization.kt")
|
||||
public void testDifferenceInCapitalization() throws Exception {
|
||||
runTest("js/js.translator/testData/box/nameClashes/differenceInCapitalization.kt");
|
||||
|
||||
+5
@@ -5940,6 +5940,11 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/nameClashes/constructorLocalVar.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("constructorsCrossFile.kt")
|
||||
public void testConstructorsCrossFile() throws Exception {
|
||||
runTest("js/js.translator/testData/box/nameClashes/constructorsCrossFile.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("differenceInCapitalization.kt")
|
||||
public void testDifferenceInCapitalization() throws Exception {
|
||||
runTest("js/js.translator/testData/box/nameClashes/differenceInCapitalization.kt");
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1276
|
||||
// FILE: lib.kt
|
||||
|
||||
// Force contructor renaming
|
||||
val dummy = run {
|
||||
if (false) {
|
||||
js("A")
|
||||
js("A_init")
|
||||
}
|
||||
null
|
||||
}
|
||||
|
||||
class A(val s: String) {
|
||||
constructor(c: Char) : this("$c")
|
||||
}
|
||||
|
||||
inline fun ok() = A("O").s + A('K').s
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
|
||||
// TODO add directives for primary contructor invocations
|
||||
// CHECK_CALLED_IN_SCOPE: function=A_init_0 scope=box
|
||||
// CHECK_NOT_CALLED_IN_SCOPE: function=A_init scope=box
|
||||
fun box(): String {
|
||||
if (A("O").s + A('K').s != "OK") return "fail"
|
||||
|
||||
return ok()
|
||||
}
|
||||
Reference in New Issue
Block a user