[K2] Do not report CONFLICTING_OVERLOADS for hidden callables.

This makes sense as such callables do not conflict on their use-sites,
because a hidden callable loses to a non-hidden one when doing
overload resolution.

We achieve this by not considering such callables as conflicting when
collecting them in FirDeclarationCollector.
A callable is hidden if it will be hidden from the overload resolution,
meaning it has a `Deprecated` or `DeprecatedSinceKotlin` annotation.

NB: this also impacts `REDECLARATION` diagnostic for properties, as they
can also be marked as `Deprecated`.

NB: this change ignores local callables, as they are ignored
w.r.t. `Deprecated` in K2.

^KT-22004 Fixed
This commit is contained in:
marat.akhin
2023-09-22 15:08:59 +02:00
committed by Space Team
parent 8e7e24cc31
commit 968c116ecd
30 changed files with 1025 additions and 3 deletions
@@ -0,0 +1,7 @@
// ISSUE: KT-61168
class A<!CONFLICTING_OVERLOADS!>()<!> {
}
<!CONFLICTING_OVERLOADS!>@Deprecated("A", level = DeprecationLevel.HIDDEN)
fun A()<!> = A()