From 67afd12f94f9ceebd5f91340e0608d54a16722a6 Mon Sep 17 00:00:00 2001 From: Sergej Jaskiewicz Date: Tue, 5 Mar 2024 18:30:05 +0100 Subject: [PATCH] [test] Remove redundant signature clash diagnotic test from Native tests Since d8d8f24f62d22694b9278f8ffa4018038b2e1ac5 the tests for this diagnostic are run with the Compiler Core test infrastructure (see `compiler/testData/diagnostics/klibSerializationTests`) There is no need to test it separately in `FirCompilerOutputTest`. ^KT-64393 Fixed --- .../SignatureClashDiagnostics/lib.kt | 3 -- .../SignatureClashDiagnostics/main.kt | 25 ---------- .../SignatureClashDiagnostics/output.txt | 47 ------------------- .../konan/test/blackbox/CompilerOutputTest.kt | 17 ++----- 4 files changed, 3 insertions(+), 89 deletions(-) delete mode 100644 native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/lib.kt delete mode 100644 native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt delete mode 100644 native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/output.txt diff --git a/native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/lib.kt b/native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/lib.kt deleted file mode 100644 index 988868572bb..00000000000 --- a/native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/lib.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.example.klib.serialization.diagnostics - -fun movedToLib() {} diff --git a/native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt b/native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt deleted file mode 100644 index 4584cd85c5b..00000000000 --- a/native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt +++ /dev/null @@ -1,25 +0,0 @@ -package com.example.klib.serialization.diagnostics - -class A { - @Deprecated("", level = DeprecationLevel.HIDDEN) - fun foo(): String = "" - - fun foo(): Int = 0 -} - -var myVal: Long = 0L - -@Deprecated("This function moved to the 'lib' module", level = DeprecationLevel.HIDDEN) -fun movedToLib() {} - -@Deprecated("", level = DeprecationLevel.HIDDEN) -var myVal: Int = 0 - -@Deprecated("", level = DeprecationLevel.HIDDEN) -val myVal: String - get() = "" - -fun main() { - println(A().foo()) - movedToLib() -} diff --git a/native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/output.txt b/native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/output.txt deleted file mode 100644 index 1f21af6ae23..00000000000 --- a/native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/output.txt +++ /dev/null @@ -1,47 +0,0 @@ -native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:4:5: error: platform declaration clash: The following functions have the same IR signature (com.example.klib.serialization.diagnostics/A.foo|foo(){}[0]): - fun foo(): kotlin.String defined in com.example.klib.serialization.diagnostics.A - fun foo(): kotlin.Int defined in com.example.klib.serialization.diagnostics.A - @Deprecated("", level = DeprecationLevel.HIDDEN) - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:7:5: error: platform declaration clash: The following functions have the same IR signature (com.example.klib.serialization.diagnostics/A.foo|foo(){}[0]): - fun foo(): kotlin.String defined in com.example.klib.serialization.diagnostics.A - fun foo(): kotlin.Int defined in com.example.klib.serialization.diagnostics.A - fun foo(): Int = 0 - ^^^^^^^^^^^^^^^^^^ -native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:10:1: error: platform declaration clash: The following properties have the same IR signature (com.example.klib.serialization.diagnostics/myVal|{}myVal[0]): - val myVal: kotlin.String defined in com.example.klib.serialization.diagnostics - var myVal: kotlin.Int defined in com.example.klib.serialization.diagnostics - var myVal: kotlin.Long defined in com.example.klib.serialization.diagnostics -var myVal: Long = 0L -^^^^^^^^^^^^^^^^^^^^ -native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:10:1: error: platform declaration clash: The following functions have the same IR signature (com.example.klib.serialization.diagnostics/myVal.|(){}[0]): - fun ``(): kotlin.Int defined in com.example.klib.serialization.diagnostics - fun ``(): kotlin.Long defined in com.example.klib.serialization.diagnostics - fun ``(): kotlin.String defined in com.example.klib.serialization.diagnostics -var myVal: Long = 0L -^^^^^^^^^^^^^^^^^^^^ -native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:15:1: error: platform declaration clash: The following properties have the same IR signature (com.example.klib.serialization.diagnostics/myVal|{}myVal[0]): - val myVal: kotlin.String defined in com.example.klib.serialization.diagnostics - var myVal: kotlin.Int defined in com.example.klib.serialization.diagnostics - var myVal: kotlin.Long defined in com.example.klib.serialization.diagnostics -@Deprecated("", level = DeprecationLevel.HIDDEN) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:15:1: error: platform declaration clash: The following functions have the same IR signature (com.example.klib.serialization.diagnostics/myVal.|(){}[0]): - fun ``(): kotlin.Int defined in com.example.klib.serialization.diagnostics - fun ``(): kotlin.Long defined in com.example.klib.serialization.diagnostics - fun ``(): kotlin.String defined in com.example.klib.serialization.diagnostics -@Deprecated("", level = DeprecationLevel.HIDDEN) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:18:1: error: platform declaration clash: The following properties have the same IR signature (com.example.klib.serialization.diagnostics/myVal|{}myVal[0]): - val myVal: kotlin.String defined in com.example.klib.serialization.diagnostics - var myVal: kotlin.Int defined in com.example.klib.serialization.diagnostics - var myVal: kotlin.Long defined in com.example.klib.serialization.diagnostics -@Deprecated("", level = DeprecationLevel.HIDDEN) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -native/native.tests/testData/compilerOutput/SignatureClashDiagnostics/main.kt:20:5: error: platform declaration clash: The following functions have the same IR signature (com.example.klib.serialization.diagnostics/myVal.|(){}[0]): - fun ``(): kotlin.Int defined in com.example.klib.serialization.diagnostics - fun ``(): kotlin.Long defined in com.example.klib.serialization.diagnostics - fun ``(): kotlin.String defined in com.example.klib.serialization.diagnostics - get() = "" - ^^^^^^^^^^ -COMPILATION_ERROR diff --git a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/CompilerOutputTest.kt b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/CompilerOutputTest.kt index f76bf47348f..b35e9731463 100644 --- a/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/CompilerOutputTest.kt +++ b/native/native.tests/tests/org/jetbrains/kotlin/konan/test/blackbox/CompilerOutputTest.kt @@ -164,25 +164,14 @@ abstract class CompilerOutputTestBase : AbstractNativeSimpleTest() { } } +@Suppress("JUnitTestCaseWithNoTests") @TestDataPath("\$PROJECT_ROOT") @EnforcedProperty(ClassLevelProperty.COMPILER_OUTPUT_INTERCEPTOR, "NONE") class ClassicCompilerOutputTest : CompilerOutputTestBase() +@Suppress("JUnitTestCaseWithNoTests") @FirPipeline @Tag("frontend-fir") @TestDataPath("\$PROJECT_ROOT") @EnforcedProperty(ClassLevelProperty.COMPILER_OUTPUT_INTERCEPTOR, "NONE") -class FirCompilerOutputTest : CompilerOutputTestBase() { - - @Test - fun testSignatureClashDiagnostics() { - // TODO: use the Compiler Core test infrastructure for testing these diagnostics (KT-64393) - val rootDir = File("native/native.tests/testData/compilerOutput/SignatureClashDiagnostics") - val settings = testRunSettings - val lib = compileLibrary(settings, rootDir.resolve("lib.kt")).assertSuccess().resultingArtifact - val compilationResult = compileLibrary(settings, rootDir.resolve("main.kt"), dependencies = listOf(lib)) - val goldenData = rootDir.resolve("output.txt") - - KotlinTestUtils.assertEqualsToFile(goldenData, compilationResult.toOutput()) - } -} \ No newline at end of file +class FirCompilerOutputTest : CompilerOutputTestBase()