From d491eba629b11b9a0efb912fdc04ac3d66e8e91c Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Fri, 7 Oct 2022 11:18:41 +0200 Subject: [PATCH] K2: add reproducer for KT-54275 --- ...nosisCompilerFirTestdataTestGenerated.java | 6 ++++ .../exceptionInRepeatedAnnotation.fir.txt | 31 +++++++++++++++++++ .../problems/exceptionInRepeatedAnnotation.kt | 17 ++++++++++ .../runners/FirDiagnosticTestGenerated.java | 6 ++++ ...DiagnosticsWithLightTreeTestGenerated.java | 6 ++++ 5 files changed, 66 insertions(+) create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/exceptionInRepeatedAnnotation.fir.txt create mode 100644 compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/exceptionInRepeatedAnnotation.kt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java index 5997ba426be..1ad8d1a3ada 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosisCompilerFirTestdataTestGenerated.java @@ -6049,6 +6049,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/EnumMapGet.kt"); } + @Test + @TestMetadata("exceptionInRepeatedAnnotation.kt") + public void testExceptionInRepeatedAnnotation() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/exceptionInRepeatedAnnotation.kt"); + } + @Test @TestMetadata("immutableName.kt") public void testImmutableName() throws Exception { diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/exceptionInRepeatedAnnotation.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/exceptionInRepeatedAnnotation.fir.txt new file mode 100644 index 00000000000..3f32c97a821 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/exceptionInRepeatedAnnotation.fir.txt @@ -0,0 +1,31 @@ +FILE: exceptionInRepeatedAnnotation.kt + public final typealias EventHandler = R|(@R|kotlin/ParameterName|(name = String(e)) E) -> kotlin/Unit| + public final class EventListener : R|kotlin/Any| { + public constructor(): R|EventListener| { + super() + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|EventListener.Companion| { + super() + } + + public final inline operator fun invoke(noinline callback: R|EventHandler|): R|EventListener| { + ^invoke R|kotlin/TODO|() + } + + } + + } + public final inline fun R|EventHandler|.withPriority(): R|EventListener<@R|kotlin/ParameterName|(name = String(e)) E>| { + ^withPriority Q|EventListener|.R|/EventListener.Companion.invoke|(this@R|/withPriority|) + } + public final inline fun R|EventHandler|.withDefaultPriority(): R|EventListener<@R|kotlin/ParameterName|(name = String(e)) @R|kotlin/ParameterName|(name = String(e)) E>| { + ^withDefaultPriority this@R|/withDefaultPriority|.R|/withPriority|() + } + public abstract class Event : R|kotlin/Any| { + public constructor(): R|Event| { + super() + } + + } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/exceptionInRepeatedAnnotation.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/exceptionInRepeatedAnnotation.kt new file mode 100644 index 00000000000..1ae02c2624f --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/exceptionInRepeatedAnnotation.kt @@ -0,0 +1,17 @@ +typealias EventHandler = (e: E) -> Unit + +class EventListener() { + + companion object { + + inline operator fun invoke( + noinline callback: EventHandler, + ): EventListener = TODO() + } +} + +inline fun EventHandler.withPriority() = EventListener(this) + +inline fun EventHandler.withDefaultPriority() = withPriority() + +abstract class Event diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java index 8319e2d4f4a..2cc19f7d777 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticTestGenerated.java @@ -6049,6 +6049,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest { runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/EnumMapGet.kt"); } + @Test + @TestMetadata("exceptionInRepeatedAnnotation.kt") + public void testExceptionInRepeatedAnnotation() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/exceptionInRepeatedAnnotation.kt"); + } + @Test @TestMetadata("immutableName.kt") public void testImmutableName() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java index 918d389fbd4..42a3cc6f799 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirDiagnosticsWithLightTreeTestGenerated.java @@ -6049,6 +6049,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/EnumMapGet.kt"); } + @Test + @TestMetadata("exceptionInRepeatedAnnotation.kt") + public void testExceptionInRepeatedAnnotation() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/exceptionInRepeatedAnnotation.kt"); + } + @Test @TestMetadata("immutableName.kt") public void testImmutableName() throws Exception {