From 55aae5325c80d8ba746a6aed3138c7ea911f6427 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 17 Oct 2022 11:25:52 +0300 Subject: [PATCH] [Test] Add test for KT-54209 --- ...isCompilerTestFE10TestdataTestGenerated.java | 6 ++++++ .../FirOldFrontendDiagnosticsTestGenerated.java | 6 ++++++ ...ndDiagnosticsWithLightTreeTestGenerated.java | 6 ++++++ .../deprecatedCompanionAndClassReference.fir.kt | 12 ++++++++++++ .../deprecatedCompanionAndClassReference.kt | 12 ++++++++++++ .../deprecatedCompanionAndClassReference.txt | 17 +++++++++++++++++ .../test/runners/DiagnosticTestGenerated.java | 6 ++++++ 7 files changed, 65 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.fir.kt create mode 100644 compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.kt create mode 100644 compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.txt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java index 733cedd5402..fc4ba5a0929 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java @@ -8968,6 +8968,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/deprecated/componentUsage.kt"); } + @Test + @TestMetadata("deprecatedCompanionAndClassReference.kt") + public void testDeprecatedCompanionAndClassReference() throws Exception { + runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.kt"); + } + @Test @TestMetadata("deprecatedConstructor.kt") public void testDeprecatedConstructor() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index 431e2546fca..78d350054e7 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -8968,6 +8968,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/deprecated/componentUsage.kt"); } + @Test + @TestMetadata("deprecatedCompanionAndClassReference.kt") + public void testDeprecatedCompanionAndClassReference() throws Exception { + runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.kt"); + } + @Test @TestMetadata("deprecatedConstructor.kt") public void testDeprecatedConstructor() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java index 56d7c665c33..ca053f1c8c4 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.java @@ -8968,6 +8968,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/deprecated/componentUsage.kt"); } + @Test + @TestMetadata("deprecatedCompanionAndClassReference.kt") + public void testDeprecatedCompanionAndClassReference() throws Exception { + runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.kt"); + } + @Test @TestMetadata("deprecatedConstructor.kt") public void testDeprecatedConstructor() throws Exception { diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.fir.kt b/compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.fir.kt new file mode 100644 index 00000000000..eb59f8fab4b --- /dev/null +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.fir.kt @@ -0,0 +1,12 @@ +// ISSUE: KT-54209 + +class A { + @Deprecated("Deprecated companion") + companion object +} + + +fun test() { + A::class + A.Companion::class +} diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.kt b/compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.kt new file mode 100644 index 00000000000..48a0ee1f22d --- /dev/null +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.kt @@ -0,0 +1,12 @@ +// ISSUE: KT-54209 + +class A { + @Deprecated("Deprecated companion") + companion object +} + + +fun test() { + A::class + A.Companion::class +} diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.txt b/compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.txt new file mode 100644 index 00000000000..65d728cde84 --- /dev/null +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.txt @@ -0,0 +1,17 @@ +package + +public fun test(): kotlin.Unit + +public final class A { + public constructor A() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + + @kotlin.Deprecated(message = "Deprecated companion") public companion object Companion { + private constructor Companion() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String + } +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index e05a412db83..0d216d06b93 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -8974,6 +8974,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/deprecated/componentUsage.kt"); } + @Test + @TestMetadata("deprecatedCompanionAndClassReference.kt") + public void testDeprecatedCompanionAndClassReference() throws Exception { + runTest("compiler/testData/diagnostics/tests/deprecated/deprecatedCompanionAndClassReference.kt"); + } + @Test @TestMetadata("deprecatedConstructor.kt") public void testDeprecatedConstructor() throws Exception {