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 34784227c87..90bf9b4ce0f 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 @@ -15965,6 +15965,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt52431.kt"); } + @Test + @TestMetadata("kt54411.kt") + public void testKt54411() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt54411.kt"); + } + @Test @TestMetadata("nullableEmptyIntersection.kt") public void testNullableEmptyIntersection() 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 6b42eca6a63..b7e47a78fcf 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 @@ -15971,6 +15971,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt52431.kt"); } + @Test + @TestMetadata("kt54411.kt") + public void testKt54411() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt54411.kt"); + } + @Test @TestMetadata("nullableEmptyIntersection.kt") public void testNullableEmptyIntersection() 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 efab1d9eeb4..d1b2424f182 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 @@ -15965,6 +15965,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt52431.kt"); } + @Test + @TestMetadata("kt54411.kt") + public void testKt54411() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt54411.kt"); + } + @Test @TestMetadata("nullableEmptyIntersection.kt") public void testNullableEmptyIntersection() throws Exception { diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt54411.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt54411.kt new file mode 100644 index 00000000000..ea7eb3b3ac6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt54411.kt @@ -0,0 +1,21 @@ +// FIR_IDENTICAL +class AtomicRef(val value: T) + +inline fun > AtomicRef.findSegmentAndMoveForward(createNewSegment: (prev: F?) -> F) = null + +interface Queue { + val tail: AtomicRef> + + fun enqueue(element: Q) { + // F <: Segment from upper bound + // F <: OneElementSegment>? from ::createSegment argument. ? is questionable here + // (F?) -> F <: (OneElementSegment?) -> OneElementSegment + tail.findSegmentAndMoveForward(::createSegment) + } +} + +private fun createSegment(prev: OneElementSegment?) = OneElementSegment() + +class OneElementSegment() : Segment>() + +abstract class Segment> diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt54411.txt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt54411.txt new file mode 100644 index 00000000000..6edbe4d60f9 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt54411.txt @@ -0,0 +1,34 @@ +package + +private fun createSegment(/*0*/ prev: OneElementSegment?): OneElementSegment +public inline fun > AtomicRef.findSegmentAndMoveForward(/*0*/ createNewSegment: (prev: F?) -> F): kotlin.Nothing? + +public final class AtomicRef { + public constructor AtomicRef(/*0*/ value: T) + public final val value: T + 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 +} + +public final class OneElementSegment : Segment> { + public constructor OneElementSegment() + 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 +} + +public interface Queue { + public abstract val tail: AtomicRef> + public open fun enqueue(/*0*/ element: Q): kotlin.Unit + 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 +} + +public abstract class Segment> { + public constructor Segment>() + 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 9f80978c1b8..d633015cccd 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 @@ -15971,6 +15971,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt52431.kt"); } + @Test + @TestMetadata("kt54411.kt") + public void testKt54411() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt54411.kt"); + } + @Test @TestMetadata("nullableEmptyIntersection.kt") public void testNullableEmptyIntersection() throws Exception {