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 671d156855c..6e92ab0e116 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 @@ -15385,6 +15385,18 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_34.kt"); } + @Test + @TestMetadata("kt45461_35.kt") + public void testKt45461_35() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.kt"); + } + + @Test + @TestMetadata("kt45461_35_Enabled.kt") + public void testKt45461_35_Enabled() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.kt"); + } + @Test @TestMetadata("kt45461_4.kt") public void testKt45461_4() 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 e2519c02be6..3eace25b4ec 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 @@ -15385,6 +15385,18 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_34.kt"); } + @Test + @TestMetadata("kt45461_35.kt") + public void testKt45461_35() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.kt"); + } + + @Test + @TestMetadata("kt45461_35_Enabled.kt") + public void testKt45461_35_Enabled() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.kt"); + } + @Test @TestMetadata("kt45461_4.kt") public void testKt45461_4() throws Exception { diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.fir.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.fir.kt new file mode 100644 index 00000000000..238defcb89d --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.fir.kt @@ -0,0 +1,16 @@ +// WITH_STDLIB + +class Foo + +class Bar + +fun Bar.takeFoo(foo: Foo): Int = 1 + +class Inv + +fun Inv>> main() { + fun T> Bar.takeFoo(foo: Foo): String = "" + + val foo = Foo() + Bar>>().takeFoo(foo) +} diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.kt new file mode 100644 index 00000000000..0b8ffdaf7d3 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.kt @@ -0,0 +1,16 @@ +// WITH_STDLIB + +class Foo + +class Bar + +fun Bar.takeFoo(foo: Foo): Int = 1 + +class Inv + +fun Inv>> main() { + fun Bar.takeFoo(foo: Foo): String = "" + + val foo = Foo() + Bar>>().takeFoo(foo) +} diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.txt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.txt new file mode 100644 index 00000000000..543a6cfa0b0 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.txt @@ -0,0 +1,25 @@ +package + +public fun >> main(): kotlin.Unit +public fun Bar.takeFoo(/*0*/ foo: Foo): kotlin.Int + +public final class Bar { + public constructor Bar() + 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 Foo { + public constructor Foo() + 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 Inv { + public constructor Inv() + 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/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.fir.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.fir.kt new file mode 100644 index 00000000000..5b978ffd14b --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.fir.kt @@ -0,0 +1,17 @@ +// !LANGUAGE: +ForbidInferringTypeVariablesIntoEmptyIntersection +// WITH_STDLIB + +class Foo + +class Bar + +fun Bar.takeFoo(foo: Foo): Int = 1 + +class Inv + +fun Inv>> main() { + fun T> Bar.takeFoo(foo: Foo): String = "" + + val foo = Foo() + Bar>>().takeFoo(foo) +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.kt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.kt new file mode 100644 index 00000000000..cee3241561b --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.kt @@ -0,0 +1,17 @@ +// !LANGUAGE: +ForbidInferringTypeVariablesIntoEmptyIntersection +// WITH_STDLIB + +class Foo + +class Bar + +fun Bar.takeFoo(foo: Foo): Int = 1 + +class Inv + +fun Inv>> main() { + fun Bar.takeFoo(foo: Foo): String = "" + + val foo = Foo() + Bar>>().takeFoo(foo) +} diff --git a/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.txt b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.txt new file mode 100644 index 00000000000..543a6cfa0b0 --- /dev/null +++ b/compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.txt @@ -0,0 +1,25 @@ +package + +public fun >> main(): kotlin.Unit +public fun Bar.takeFoo(/*0*/ foo: Foo): kotlin.Int + +public final class Bar { + public constructor Bar() + 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 Foo { + public constructor Foo() + 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 Inv { + public constructor Inv() + 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 2b50b20167f..0bec22ee46b 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 @@ -15391,6 +15391,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_34.kt"); } + @Test + @TestMetadata("kt45461_35.kt") + public void testKt45461_35() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35.kt"); + } + + @Test + @TestMetadata("kt45461_35_Enabled.kt") + public void testKt45461_35_Enabled() throws Exception { + runTest("compiler/testData/diagnostics/tests/inference/emptyIntersectionTypes/kt45461_35_Enabled.kt"); + } + @Test @TestMetadata("kt45461_4.kt") public void testKt45461_4() throws Exception {