[FIR] Check conflicts between nested classes' constructors and member functions

For an example of an object with
an implicit primary constructor,
see `FirPsiOldFrontendDiagnosticsTestGenerated.testSingletonAndFunctionSameName`.

^KT-62005 Fixed


Merge-request: KT-MR-12242
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
This commit is contained in:
Nikolay Lunyak
2023-09-18 11:41:42 +00:00
committed by Space Team
parent 777df2d923
commit 93958ec73d
12 changed files with 95 additions and 14 deletions
@@ -0,0 +1,10 @@
// FIR_IDENTICAL
// ISSUE: KT-62005
class A {
class NestedInA<!CONFLICTING_OVERLOADS!>()<!>
<!CONFLICTING_OVERLOADS!>fun NestedInA()<!> {}
class <!CONFLICTING_OVERLOADS!>NestedInA2<!>
<!CONFLICTING_OVERLOADS!>fun NestedInA2()<!> {}
}
@@ -15,16 +15,16 @@ class a<!CONFLICTING_OVERLOADS!>()<!> { }
<!CONFLICTING_OVERLOADS!>fun a()<!> = 1
class Tram {
fun f() { }
<!CONFLICTING_OVERLOADS!>fun f()<!> { }
class f() { }
class f<!CONFLICTING_OVERLOADS!>()<!> { }
}
class Yvayva {
companion object {
fun fghj() { }
<!CONFLICTING_OVERLOADS!>fun fghj()<!> { }
class fghj() { }
class fghj<!CONFLICTING_OVERLOADS!>()<!> { }
}
}
@@ -7,17 +7,21 @@ package kt2438
class B {
class <!REDECLARATION!>C<!>
class <!REDECLARATION!>C<!>
class <!CONFLICTING_OVERLOADS, REDECLARATION!>D<!>
class <!CONFLICTING_OVERLOADS, REDECLARATION!>D<!>
<!CONFLICTING_OVERLOADS!>fun D()<!> {}
}
class A {
class <!REDECLARATION!>B<!>
companion object {
class <!REDECLARATION!>B<!>
class <!REDECLARATION!>B<!>
}
class <!REDECLARATION!>B<!>
}
@@ -46,6 +46,7 @@ package kt2438 {
public final class B {
public constructor B()
public final fun D(): 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
@@ -63,5 +64,20 @@ package kt2438 {
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class D {
public constructor D()
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 D {
public constructor D()
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
}
}
}
@@ -13,15 +13,15 @@ class B {
<!CONFLICTING_OVERLOADS!>fun B(x: Int)<!> {}
class Outer {
class A(x: String = "", y: String = "") {
constructor(x: String, y: String): <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>(x, y)
constructor(): <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "")
constructor(): <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "")
class A<!CONFLICTING_OVERLOADS!>(x: String = "", y: String = "")<!> {
<!CONFLICTING_OVERLOADS!>constructor(x: String, y: String)<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>(x, y)
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "")
<!CONFLICTING_OVERLOADS!>constructor()<!>: <!OVERLOAD_RESOLUTION_AMBIGUITY!>this<!>("", "")
}
class B {
constructor(x: Int)
<!CONFLICTING_OVERLOADS!>constructor(x: Int)<!>
}
fun B(x: Int) {}
<!CONFLICTING_OVERLOADS!>fun B(x: Int)<!> {}
}