Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/invokePriority.kt
T
Denis Zharkov 6cc6b9efcb FIR: Fix overload resolution for some invoke cases
Namely, it's about the cases when there are multiple variable candidates
with the same priority and all of them should be collected and compared
2020-04-02 12:10:50 +03:00

35 lines
749 B
Kotlin
Vendored

class A {
fun bar() {
val foo: String.() -> Unit = {} // (1)
fun String.foo(): Unit {} // (2)
"1".foo() // resolves to (2)
with("2") {
foo() // BUG: resolves to (1) in old FE, but to (2) in FIR
}
}
}
class B {
val foo: String.() -> Unit = {} // (1)
fun String.foo(): Unit {} // (2)
fun bar() {
"1".foo() // resolves to (2)
with("2") {
foo() // resolves to (2)
}
}
}
class E {
object f {
operator fun invoke() = Unit // (1)
}
companion object {
val f: () -> Unit = {} // (2)
}
}
fun main() {
E.<!AMBIGUITY!>f<!>() // Resolves to (2) in old FE (ambiguity in FIR)
E.f.invoke() // Resolves to (1)
}