[FIR] Report CONFLICTING_OVERLOADS for local functions

^KT-59186 Fixed
This commit is contained in:
Nikolay Lunyak
2023-08-09 12:14:10 +03:00
committed by Space Team
parent 6fa5363cf4
commit cf655fd5ad
10 changed files with 163 additions and 80 deletions
@@ -1,9 +1,9 @@
fun foo() {
class A
fun bar() {}
(fun bar() {})
fun A.foo() {}
(fun A.foo() {})
<!CONFLICTING_OVERLOADS!>fun bar()<!> {}
(<!CONFLICTING_OVERLOADS!>fun bar()<!> {})
<!CONFLICTING_OVERLOADS!>fun A.foo()<!> {}
(<!CONFLICTING_OVERLOADS!>fun A.foo()<!> {})
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>run<!>(<!ANONYMOUS_FUNCTION_WITH_NAME!>fun foo() {}<!>)
}
@@ -0,0 +1,12 @@
// FIR_IDENTICAL
// ISSUE: KT-59186
fun main() {
<!CONFLICTING_OVERLOADS!>fun p () : Char<!> {
return 'c'
}
<!CONFLICTING_OVERLOADS!>fun p () : Float<!> {
return 13.0f
}
}
@@ -1,15 +1,15 @@
fun test() {
fun test1() {}
fun test1() {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
fun Any.test3() {}
fun Any.test3() {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
fun test4(): Int = 0
fun test4(): String = ""
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
class Test5(val x: Int) {
constructor(): this(0)
@@ -18,17 +18,17 @@ fun test() {
fun Test5(x: Int) = x
fun local() {
fun test1() {}
fun test1() {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
fun Any.test3() {}
fun Any.test3() {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
fun test4(): Int = 0
fun test4(): String = ""
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
class Test5(val x: Int) {
constructor(): this(0)
@@ -40,37 +40,37 @@ fun test() {
class Test {
init {
fun test1() {}
fun test1() {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
fun Any.test3() {}
fun Any.test3() {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
fun test4(): Int = 0
fun test4(): String = ""
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
class Test5(val x: Int) {
constructor(): this(0)
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
}
fun Test5() {}
fun Test5(x: Int) = x
<!CONFLICTING_OVERLOADS!>fun Test5()<!> {}
<!CONFLICTING_OVERLOADS!>fun Test5(x: Int)<!> = x
}
fun test() {
fun test1() {}
fun test1() {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
fun Any.test3() {}
fun Any.test3() {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
fun test4(): Int = 0
fun test4(): String = ""
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
class Test5(val x: Int) {
constructor(): this(0)
@@ -80,17 +80,17 @@ class Test {
}
val property: Any get() {
fun test1() {}
fun test1() {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
fun Any.test3() {}
fun Any.test3() {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
fun test4(): Int = 0
fun test4(): String = ""
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
class Test5(val x: Int) {
constructor(): this(0)
@@ -103,17 +103,17 @@ class Test {
}
val property: Any get() {
fun test1() {}
fun test1() {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
fun Any.test3() {}
fun Any.test3() {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
fun test4(): Int = 0
fun test4(): String = ""
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
class Test5(val x: Int) {
constructor(): this(0)
@@ -126,17 +126,17 @@ val property: Any get() {
object Object {
fun test() {
fun test1() {}
fun test1() {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
fun Any.test3() {}
fun Any.test3() {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
fun test4(): Int = 0
fun test4(): String = ""
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
class Test5(val x: Int) {
constructor(): this(0)
@@ -146,17 +146,17 @@ object Object {
}
val property: Any get() {
fun test1() {}
fun test1() {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
fun Any.test3() {}
fun Any.test3() {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
fun test4(): Int = 0
fun test4(): String = ""
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
class Test5(val x: Int) {
constructor(): this(0)
@@ -170,44 +170,44 @@ object Object {
val obj = object {
fun test() {
fun test1() {}
fun test1() {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
fun Any.test3() {}
fun Any.test3() {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
fun test4(): Int = 0
fun test4(): String = ""
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
class Test5(val x: Int) {
constructor(): this(0)
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
}
fun Test5() {}
fun Test5(x: Int) = x
<!CONFLICTING_OVERLOADS!>fun Test5()<!> {}
<!CONFLICTING_OVERLOADS!>fun Test5(x: Int)<!> = x
}
val property: Any get() {
fun test1() {}
fun test1() {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
<!CONFLICTING_OVERLOADS!>fun test1()<!> {}
fun Any.test2() {}
fun test2(x: Any) = x
fun Any.test3() {}
fun Any.test3() {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
<!CONFLICTING_OVERLOADS!>fun Any.test3()<!> {}
fun test4(): Int = 0
fun test4(): String = ""
<!CONFLICTING_OVERLOADS!>fun test4(): Int<!> = 0
<!CONFLICTING_OVERLOADS!>fun test4(): String<!> = ""
class Test5(val x: Int) {
constructor(): this(0)
class Test5<!CONFLICTING_OVERLOADS!>(val x: Int)<!> {
<!CONFLICTING_OVERLOADS!>constructor()<!>: this(0)
}
fun Test5() {}
fun Test5(x: Int) = x
<!CONFLICTING_OVERLOADS!>fun Test5()<!> {}
<!CONFLICTING_OVERLOADS!>fun Test5(x: Int)<!> = x
return 0
}
}
}