From b71797383fa91a091bc8cfde94183c63809e2117 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 10 Jan 2024 15:50:23 +0200 Subject: [PATCH] [Test] Add CLI tests for platform checkers in MPP ^KT-58881 --- .../firMultiplatformCompilationWithError.args | 13 ++++++++++++ .../firMultiplatformCompilationWithError.out | 20 +++++++++++++++++++ .../firMultiplatformCompilationWithError.out | 3 +++ .../common.kt | 4 ++++ .../jvm.kt | 4 ++++ .../kotlin/cli/CliTestGenerated.java | 5 +++++ 6 files changed, 49 insertions(+) create mode 100644 compiler/testData/cli/js/firMultiplatformCompilationWithError.args create mode 100644 compiler/testData/cli/js/firMultiplatformCompilationWithError.out diff --git a/compiler/testData/cli/js/firMultiplatformCompilationWithError.args b/compiler/testData/cli/js/firMultiplatformCompilationWithError.args new file mode 100644 index 00000000000..353e4fca592 --- /dev/null +++ b/compiler/testData/cli/js/firMultiplatformCompilationWithError.args @@ -0,0 +1,13 @@ +$TESTDATA_DIR$/../jvm/firMultiplatformCompilationWithError/common.kt +$TESTDATA_DIR$/../jvm/firMultiplatformCompilationWithError/jvm.kt +-Xcommon-sources +$TESTDATA_DIR$/../jvm/firMultiplatformCompilationWithError/common.kt +-language-version +2.0 +-ir-output-dir +$TEMP_DIR$ +-ir-output-name +firMultiplatformCompilationWithError +-XXLanguage\:+MultiPlatformProjects +-libraries +libraries/stdlib/build/classes/kotlin/js/main diff --git a/compiler/testData/cli/js/firMultiplatformCompilationWithError.out b/compiler/testData/cli/js/firMultiplatformCompilationWithError.out new file mode 100644 index 00000000000..b60b9279ca7 --- /dev/null +++ b/compiler/testData/cli/js/firMultiplatformCompilationWithError.out @@ -0,0 +1,20 @@ +warning: advanced option value is passed in an obsolete form. Please use the '=' character to specify the value: -Xcommon-sources=... +warning: ATTENTION! +This build uses unsafe internal compiler arguments: + +-XXLanguage:+MultiPlatformProjects + +This mode is not recommended for production use, +as no stability/compatibility guarantees are given on +compiler or generated code. Use it at your own risk! + +compiler/testData/cli/jvm/firMultiplatformCompilationWithError/common.kt:7:1: error: class 'CommonClass' is not abstract and does not implement abstract member 'foo'. +class CommonClass : B +^ +compiler/testData/cli/jvm/firMultiplatformCompilationWithError/jvm.kt:1:18: error: 'actual interface A : Any' has no corresponding members for expected class members: + + expect fun foo(): Unit + +actual interface A + ^ +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/firMultiplatformCompilationWithError.out b/compiler/testData/cli/jvm/firMultiplatformCompilationWithError.out index 8ef5e25b59e..b60b9279ca7 100644 --- a/compiler/testData/cli/jvm/firMultiplatformCompilationWithError.out +++ b/compiler/testData/cli/jvm/firMultiplatformCompilationWithError.out @@ -8,6 +8,9 @@ This mode is not recommended for production use, as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! +compiler/testData/cli/jvm/firMultiplatformCompilationWithError/common.kt:7:1: error: class 'CommonClass' is not abstract and does not implement abstract member 'foo'. +class CommonClass : B +^ compiler/testData/cli/jvm/firMultiplatformCompilationWithError/jvm.kt:1:18: error: 'actual interface A : Any' has no corresponding members for expected class members: expect fun foo(): Unit diff --git a/compiler/testData/cli/jvm/firMultiplatformCompilationWithError/common.kt b/compiler/testData/cli/jvm/firMultiplatformCompilationWithError/common.kt index 477f8fa8465..30657f7565d 100644 --- a/compiler/testData/cli/jvm/firMultiplatformCompilationWithError/common.kt +++ b/compiler/testData/cli/jvm/firMultiplatformCompilationWithError/common.kt @@ -1,3 +1,7 @@ expect interface A { fun foo() } + +expect interface B + +class CommonClass : B diff --git a/compiler/testData/cli/jvm/firMultiplatformCompilationWithError/jvm.kt b/compiler/testData/cli/jvm/firMultiplatformCompilationWithError/jvm.kt index f6d3e8746a1..819beddd977 100644 --- a/compiler/testData/cli/jvm/firMultiplatformCompilationWithError/jvm.kt +++ b/compiler/testData/cli/jvm/firMultiplatformCompilationWithError/jvm.kt @@ -1 +1,5 @@ actual interface A + +actual interface B { + fun foo() +} diff --git a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java index 881748f8c9a..e8a336173f4 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -1328,6 +1328,11 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/js/firMppWithKlib.args"); } + @TestMetadata("firMultiplatformCompilationWithError.args") + public void testFirMultiplatformCompilationWithError() throws Exception { + runTest("compiler/testData/cli/js/firMultiplatformCompilationWithError.args"); + } + @TestMetadata("jsExtraHelp.args") public void testJsExtraHelp() throws Exception { runTest("compiler/testData/cli/js/jsExtraHelp.args");