Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/diagnostics/conflictingOverloads.ll.kt
T
Marco Pennekamp 88ac5727cc [LL FIR] KT-50732 Add support for LL FIR-specific tests (.ll.kt)
- `.ll.kt` test data can be added in cases where LL FIR resolution
  legally diverges from K2 compiler results.
- Each `.ll.kt` test is prefixed with an `LL_FIR_DIVERGENCE` directive
  which must explain why the test may diverge from K2 compiler results.
  - `LLFirDivergenceCommentChecker` ensures that each `.ll.kt` file
    contains an `LL_FIR_DIVERGENCE` directive.
- `LLFirIdenticalChecker` results in an assertion error if the `.ll.kt`
  test and its base test are completely identical, including in their
  meta info (but ignoring `LL_FIR_DIVERGENCE`).
  - The checker additionally ensures that the base source file and the
    `.ll.kt` source file have identical Kotlin source code (ignoring
    meta info and `LL_FIR_DIVERGENCE`). This ensures that both tests
    test the exact same thing.
- `.ll.kt` files are ignored by select test generators, in addition to
  `.fir.kt` files.
2023-01-16 15:20:50 +00:00

73 lines
2.0 KiB
Kotlin
Vendored

// LL_FIR_DIVERGENCE
// The compiler doesn't specify which declaration of `A` is chosen in supertype resolution given that `A` has multiple redeclarations.
// LL_FIR_DIVERGENCE
<!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
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()<!> {}