Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/diagnostics/conflictingOverloads.kt
T
Nikolay Lunyak 41c3f98419 [FIR] Make resolution of classes in FirProvider more reasonable.
See the `privateInFile.fir.kt` test.
Type mismatches are simply confusing.

`inheritorOfExpectSealedClass.out`
reports unresolved reference probably
because now it resolves into the expect
declaration, rather than the actual one.
K1 doesn't report UNRESOLVED_REFERENCE
in this case. But this is red code
anyway. And this behavior still
depends on the order in which the compiler
receives both the declarations.

^KT-59927
^KT-62567
2023-10-13 11:56:54 +00:00

72 lines
1.9 KiB
Kotlin
Vendored

<!CONFLICTING_OVERLOADS!>fun test(x: Int)<!> {}
<!CONFLICTING_OVERLOADS!>fun test(y: Int)<!> {}
fun test() {}
fun test(z: Int, c: Char) {}
open class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>A<!> {
open fun rest(s: String) {}
open val u = 20
}
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>A<!> {
}
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>B<!> : <!SUPERTYPE_NOT_INITIALIZED!>A<!> {
<!CONFLICTING_OVERLOADS!>override fun rest(s: String)<!> {}
<!CONFLICTING_OVERLOADS!>fun <!VIRTUAL_MEMBER_HIDDEN!>rest<!>(s: String)<!> {}
fun rest(l: Long) {}
override val u = 310
}
interface <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>B<!>
enum class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>B<!>
val <!REDECLARATION!>u<!> = 10
val <!REDECLARATION!>u<!> = 20
val <!SYNTAX!>(a,b)<!> = 30 to 40
val <!SYNTAX!>(c,d)<!> = 50 to 60
typealias <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>TA<!> = A
typealias <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>TA<!> = B
typealias BA = A
fun <<!CONFLICTING_UPPER_BOUNDS!>T<!>> kek(t: T) where T : (String) -> Any?, T : <!FINAL_UPPER_BOUND!>Char<!> {}
fun <<!CONFLICTING_UPPER_BOUNDS!>T<!>> kek(t: T) where T : () -> Boolean, T : <!FINAL_UPPER_BOUND!>String<!> {}
fun <T : <!FINAL_UPPER_BOUND!>Int<!>> kek(t: T) {}
fun lol(a: Array<Int>) {}
fun lol(a: Array<Boolean>) {}
<!CONFLICTING_OVERLOADS!>fun <<!CONFLICTING_UPPER_BOUNDS!>T<!>> mem(t: T)<!> where T : () -> Boolean, T : <!FINAL_UPPER_BOUND!>String<!> {}
<!CONFLICTING_OVERLOADS!>fun <<!CONFLICTING_UPPER_BOUNDS!>T<!>> mem(t: T)<!> where T : <!FINAL_UPPER_BOUND!>String<!>, T : () -> Boolean {}
class M {
companion <!REDECLARATION!>object<!> {}
val <!REDECLARATION!>Companion<!> = object : Any() {}
}
fun B.foo() {}
class L {
fun B.foo() {}
}
<!CONFLICTING_OVERLOADS!>fun mest()<!> {}
class <!CONFLICTING_OVERLOADS!>mest<!>
<!FUNCTION_DECLARATION_WITH_NO_NAME!>fun()<!> {}
<!FUNCTION_DECLARATION_WITH_NO_NAME!>private fun()<!> {}