[FIR] Check conflicting overloads via scopes

Scopes may return private symbols from
supertypes, they should not clash with
symbols from the current class.

For example, see:
`FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.FakeOverride#testPrivateFakeOverrides1`

Lombok shouldn't generate functions if the
user has defined explicit ones.

In K1 generated functions are not really
added to the declared members scope.

^KT-61243 Fixed
This commit is contained in:
Nikolay Lunyak
2023-09-20 16:52:32 +03:00
committed by Space Team
parent 973248f432
commit 4e58715760
24 changed files with 278 additions and 129 deletions
@@ -1,6 +0,0 @@
interface AsyncVal { suspend fun getVal(): Int = 1}
interface SyncVal { fun getVal(): Int = 1 }
<!CONFLICTING_INHERITED_MEMBERS, MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>class MixSuspend<!> : AsyncVal, SyncVal {
}
@@ -1,6 +1,7 @@
// FIR_IDENTICAL
interface AsyncVal { suspend fun getVal(): Int = 1}
interface SyncVal { fun getVal(): Int = 1 }
<!CONFLICTING_INHERITED_MEMBERS!>class MixSuspend<!> : AsyncVal, SyncVal {
<!CONFLICTING_INHERITED_MEMBERS, MANY_INTERFACES_MEMBER_NOT_IMPLEMENTED!>class MixSuspend<!> : AsyncVal, SyncVal {
}
@@ -1,37 +0,0 @@
// FILE: main.kt
interface A {
suspend fun foo()
fun bar()
}
interface B : A {
override fun foo() {
}
override suspend fun bar() {
}
}
interface C : A {
suspend override fun foo() {
}
override fun bar() {
}
}
<!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class D<!> : J {
suspend override fun foo() {
}
}
// FILE: J.java
public interface J extends A {
Object foo(kotlin.coroutines.Continuation<kotlin.Unit> y);
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// FILE: main.kt
interface A {
suspend fun foo()
@@ -5,11 +6,11 @@ interface A {
}
interface B : A {
<!CONFLICTING_OVERLOADS!><!NOTHING_TO_OVERRIDE!>override<!> fun foo()<!> {
override fun foo() {
}
<!CONFLICTING_OVERLOADS!><!NOTHING_TO_OVERRIDE!>override<!> suspend fun bar()<!> {
override suspend fun bar() {
}
}