968c116ecd
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
266 lines
9.5 KiB
Kotlin
Vendored
266 lines
9.5 KiB
Kotlin
Vendored
// FIR_IDENTICAL
|
|
|
|
fun test() {
|
|
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
|
fun test1()<!> {}
|
|
|
|
fun Any.test2() {}
|
|
fun test2(x: Any) = x
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
|
fun Any.test3()<!> {}
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
|
fun test4(): String<!> = ""
|
|
|
|
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
|
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
|
}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5(x: Int)<!> = x
|
|
|
|
fun local() {
|
|
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
|
fun test1()<!> {}
|
|
|
|
fun Any.test2() {}
|
|
fun test2(x: Any) = x
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
|
fun Any.test3()<!> {}
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
|
fun test4(): String<!> = ""
|
|
|
|
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
|
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
|
}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5(x: Int)<!> = x
|
|
}
|
|
}
|
|
|
|
class Test {
|
|
init {
|
|
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
|
fun test1()<!> {}
|
|
|
|
fun Any.test2() {}
|
|
fun test2(x: Any) = x
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
|
fun Any.test3()<!> {}
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
|
fun test4(): String<!> = ""
|
|
|
|
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
|
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
|
}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5(x: Int)<!> = x
|
|
}
|
|
|
|
fun test() {
|
|
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
|
fun test1()<!> {}
|
|
|
|
fun Any.test2() {}
|
|
fun test2(x: Any) = x
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
|
fun Any.test3()<!> {}
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
|
fun test4(): String<!> = ""
|
|
|
|
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
|
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
|
}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5(x: Int)<!> = x
|
|
}
|
|
|
|
val property: Any get() {
|
|
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
|
fun test1()<!> {}
|
|
|
|
fun Any.test2() {}
|
|
fun test2(x: Any) = x
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
|
fun Any.test3()<!> {}
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
|
fun test4(): String<!> = ""
|
|
|
|
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
|
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
|
}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5(x: Int)<!> = x
|
|
|
|
return 0
|
|
}
|
|
}
|
|
|
|
val property: Any get() {
|
|
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
|
fun test1()<!> {}
|
|
|
|
fun Any.test2() {}
|
|
fun test2(x: Any) = x
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
|
fun Any.test3()<!> {}
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
|
fun test4(): String<!> = ""
|
|
|
|
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
|
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
|
}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5(x: Int)<!> = x
|
|
|
|
return 0
|
|
}
|
|
|
|
object Object {
|
|
fun test() {
|
|
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
|
fun test1()<!> {}
|
|
|
|
fun Any.test2() {}
|
|
fun test2(x: Any) = x
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
|
fun Any.test3()<!> {}
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
|
fun test4(): String<!> = ""
|
|
|
|
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
|
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
|
}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5(x: Int)<!> = x
|
|
}
|
|
|
|
val property: Any get() {
|
|
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
|
fun test1()<!> {}
|
|
|
|
fun Any.test2() {}
|
|
fun test2(x: Any) = x
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
|
fun Any.test3()<!> {}
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
|
fun test4(): String<!> = ""
|
|
|
|
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
|
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
|
}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5(x: Int)<!> = x
|
|
|
|
return 0
|
|
}
|
|
}
|
|
|
|
val obj = object {
|
|
fun test() {
|
|
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
|
fun test1()<!> {}
|
|
|
|
fun Any.test2() {}
|
|
fun test2(x: Any) = x
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
|
fun Any.test3()<!> {}
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
|
fun test4(): String<!> = ""
|
|
|
|
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
|
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
|
}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5(x: Int)<!> = x
|
|
}
|
|
|
|
val property: Any get() {
|
|
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test1", level = DeprecationLevel.HIDDEN)
|
|
fun test1()<!> {}
|
|
|
|
fun Any.test2() {}
|
|
fun test2(x: Any) = x
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test3", level = DeprecationLevel.HIDDEN)
|
|
fun Any.test3()<!> {}
|
|
|
|
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("test4", level = DeprecationLevel.HIDDEN)
|
|
fun test4(): String<!> = ""
|
|
|
|
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
|
|
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
|
|
}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5()<!> {}
|
|
<!CONFLICTING_OVERLOADS!>@Deprecated("Test5", level = DeprecationLevel.HIDDEN)
|
|
fun Test5(x: Int)<!> = x
|
|
|
|
return 0
|
|
}
|
|
}
|