[IR] Add test about default arguments in expect declaration for HMMP
KT-45542
This commit is contained in:
committed by
teamcityserver
parent
5a64f64ba3
commit
876a0d9b7b
@@ -0,0 +1,51 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// EXPECT_ACTUAL_LINKER
|
||||
// IGNORE_BACKEND: WASM
|
||||
// IGNORE_BACKEND: JS
|
||||
// DONT_TARGET_EXACT_BACKEND: JVM
|
||||
// DONT_TARGET_EXACT_BACKEND: JVM_IR
|
||||
// KT-45542
|
||||
|
||||
// MODULE: E
|
||||
// FILE: e.kt
|
||||
@file:Suppress("NO_ACTUAL_FOR_EXPECT")
|
||||
|
||||
expect class Test() {
|
||||
fun size(): Int
|
||||
fun lastIndex(start: Int, end: Int = size())
|
||||
|
||||
fun result(): String
|
||||
}
|
||||
|
||||
// MODULE: A(E)
|
||||
// FILE: a.kt
|
||||
@file:Suppress("ACTUAL_WITHOUT_EXPECT")
|
||||
|
||||
actual class Test {
|
||||
|
||||
var r = ""
|
||||
|
||||
actual fun size(): Int = 3
|
||||
actual fun lastIndex(start: Int, end: Int) {
|
||||
r = "OK"
|
||||
}
|
||||
|
||||
actual fun result(): String = r
|
||||
}
|
||||
|
||||
// MODULE: U(E)
|
||||
// FILE: u.kt
|
||||
|
||||
fun foo(): String {
|
||||
val t = Test()
|
||||
t.lastIndex(0)
|
||||
return t.result()
|
||||
}
|
||||
|
||||
// MODULE: main(U, A)
|
||||
// FILE: m.kt
|
||||
|
||||
fun box(): String {
|
||||
return foo()
|
||||
}
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -18035,6 +18035,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultArgument.kt")
|
||||
public void testDefaultArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/multiModule/defaultArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("expectActualLink.kt")
|
||||
public void testExpectActualLink() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/multiModule/expectActualLink.kt");
|
||||
|
||||
Generated
+5
@@ -17441,6 +17441,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultArgument.kt")
|
||||
public void testDefaultArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/multiModule/defaultArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("expectActualLink.kt")
|
||||
public void testExpectActualLink() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/multiModule/expectActualLink.kt");
|
||||
|
||||
Generated
+5
@@ -17471,6 +17471,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/multiModule"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultArgument.kt")
|
||||
public void testDefaultArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/multiModule/defaultArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("expectActualLink.kt")
|
||||
public void testExpectActualLink() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/multiModule/expectActualLink.kt");
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
+5
@@ -14220,6 +14220,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/multiModule"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("defaultArgument.kt")
|
||||
public void testDefaultArgument() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/multiModule/defaultArgument.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("expectActualLink.kt")
|
||||
public void testExpectActualLink() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/multiplatform/multiModule/expectActualLink.kt");
|
||||
|
||||
Reference in New Issue
Block a user