diff --git a/compiler/testData/diagnostics/tests/regressions/kt5326.kt b/compiler/testData/diagnostics/tests/regressions/kt5326.kt new file mode 100644 index 00000000000..ddb458e3265 --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/kt5326.kt @@ -0,0 +1,11 @@ +class A { + fun size() = 0 +} + +class Foo(i: Int) + +public fun Foo(c: A) { + val a = Foo(c.size()) // Check no overload resolution ambiguity + val b: Foo = Foo(c.size()) // OK + val c: Foo = Foo(c.size()) // OK +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/regressions/kt5326.txt b/compiler/testData/diagnostics/tests/regressions/kt5326.txt new file mode 100644 index 00000000000..26e9f00df88 --- /dev/null +++ b/compiler/testData/diagnostics/tests/regressions/kt5326.txt @@ -0,0 +1,18 @@ +package + +public fun Foo(/*0*/ c: A): kotlin.Unit + +internal 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 + internal final fun size(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +internal final class Foo { + public constructor Foo(/*0*/ i: kotlin.Int) + 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/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java index c2d72b1543a..0c5514a0981 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/JetDiagnosticsTestGenerated.java @@ -10704,6 +10704,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest { doTest(fileName); } + @TestMetadata("kt5326.kt") + public void testKt5326() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/kt5326.kt"); + doTest(fileName); + } + @TestMetadata("kt549.kt") public void testKt549() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/regressions/kt549.kt");