Added tests for all code samples from KT-60523, except 2.3.

Test for 2.3 sample must be added in the context of KT-61792.
This commit is contained in:
Anastasia.Nekrasova
2023-09-11 19:59:15 +03:00
committed by Space Team
parent 2dae7ce6c1
commit eab6e9bb36
22 changed files with 182 additions and 0 deletions
@@ -818,6 +818,12 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/compatibleOverrides.kt");
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInPlatform.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInPlatform() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/deprecatedAnnotationOnlyOnActual_useInPlatform.kt");
}
@Test
@TestMetadata("differentOrder.kt")
public void testDifferentOrder() throws Exception {
@@ -818,6 +818,12 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/compatibleOverrides.kt");
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInPlatform.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInPlatform() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/deprecatedAnnotationOnlyOnActual_useInPlatform.kt");
}
@Test
@TestMetadata("differentOrder.kt")
public void testDifferentOrder() throws Exception {
@@ -34053,6 +34053,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/annotationsViaActualTypeAliasFromBinary.kt");
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -34053,6 +34053,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/annotationsViaActualTypeAliasFromBinary.kt");
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -34053,6 +34053,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/annotationsViaActualTypeAliasFromBinary.kt");
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -0,0 +1,42 @@
// !LANGUAGE: +MultiPlatformProjects
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE, WASM
// ISSUE: KT-60523
// MODULE: common
// TARGET_PLATFORM: Common
// FILE: common.kt
expect fun warn(): String
expect fun error(): String
expect fun hidden(): String
fun common(): String {
// no deprecation warning
if (warn() != "OK") return "Warn fail"
// no deprecation error
if (error() != "OK") return "Error fail"
// no compilation error
if (hidden() != "OK") return "Hidden fail"
return "OK"
}
// MODULE: lib()()(common)
// FILE: lib.kt
@Deprecated("", level = DeprecationLevel.WARNING)
actual fun warn(): String = "OK"
@Deprecated("", level = DeprecationLevel.ERROR)
actual fun error(): String = "OK"
@Deprecated("", level = DeprecationLevel.HIDDEN)
actual fun hidden(): String = "OK"
// MODULE: main(lib)
// FILE: main.kt
fun box(): String {
return common()
}
@@ -0,0 +1,21 @@
// FIR_IDENTICAL
// ISSUE: KT-60523
// MODULE: m1-common
// FILE: common.kt
expect fun warn()
expect fun error()
// MODULE: m1-jvm()()(m1-common)
// FILE: jvm.kt
@Deprecated("", level = DeprecationLevel.WARNING)
actual fun warn() {}
@Deprecated("", level = DeprecationLevel.ERROR)
actual fun error() {}
fun main(){
<!DEPRECATION!>warn<!>()
<!DEPRECATION_ERROR!>error<!>()
}
@@ -23813,6 +23813,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/compatibleOverrides.kt");
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInPlatform.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInPlatform() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/deprecatedAnnotationOnlyOnActual_useInPlatform.kt");
}
@Test
@TestMetadata("differentOrder.kt")
public void testDifferentOrder() throws Exception {
@@ -32355,6 +32355,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/annotationsViaActualTypeAliasFromBinary.kt");
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -34053,6 +34053,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/annotationsViaActualTypeAliasFromBinary.kt");
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -34053,6 +34053,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/annotationsViaActualTypeAliasFromBinary.kt");
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -29015,6 +29015,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/annotationsViaActualTypeAliasFromBinary.kt");
}
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void ignoreDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@TestMetadata("expectClassInJvmMultifileFacade.kt")
public void ignoreExpectClassInJvmMultifileFacade() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/expectClassInJvmMultifileFacade.kt");
@@ -23805,6 +23805,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -23805,6 +23805,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -23805,6 +23805,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -23805,6 +23805,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -26777,6 +26777,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -27395,6 +27395,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -26469,6 +26469,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -26778,6 +26778,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -23553,6 +23553,12 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2/annotations"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {
@@ -23553,6 +23553,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/multiplatform/k2/annotations"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@Test
@TestMetadata("deprecatedAnnotationOnlyOnActual_useInCommon.kt")
public void testDeprecatedAnnotationOnlyOnActual_useInCommon() throws Exception {
runTest("compiler/testData/codegen/box/multiplatform/k2/annotations/deprecatedAnnotationOnlyOnActual_useInCommon.kt");
}
@Test
@TestMetadata("expectAnnotationCallInLibrary.kt")
public void testExpectAnnotationCallInLibrary() throws Exception {