diff --git a/compiler/fir/resolve/testData/resolveWithStdlib/problems/invokePriority.kt b/compiler/fir/resolve/testData/resolveWithStdlib/problems/invokePriority.kt index 84e575655d5..a525cc41b78 100644 --- a/compiler/fir/resolve/testData/resolveWithStdlib/problems/invokePriority.kt +++ b/compiler/fir/resolve/testData/resolveWithStdlib/problems/invokePriority.kt @@ -17,4 +17,18 @@ class B { foo() // resolves to (2) } } +} + +class E { + object f { + operator fun invoke() = Unit // (1) + } + companion object { + val f: () -> Unit = {} // (2) + } +} + +fun main() { + E.f() // Resolves to (2) + E.f.invoke() // Resolves to (1) } \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolveWithStdlib/problems/invokePriority.txt b/compiler/fir/resolve/testData/resolveWithStdlib/problems/invokePriority.txt index 2aa6fd20a2d..76b64314afc 100644 --- a/compiler/fir/resolve/testData/resolveWithStdlib/problems/invokePriority.txt +++ b/compiler/fir/resolve/testData/resolveWithStdlib/problems/invokePriority.txt @@ -43,3 +43,37 @@ FILE: invokePriority.kt } } + public final class E : R|kotlin/Any| { + public constructor(): R|E| { + super() + } + + public final object f : R|kotlin/Any| { + private constructor(): R|E.f| { + super() + } + + public final operator fun invoke(): R|kotlin/Unit| { + ^invoke Q|kotlin/Unit| + } + + } + + public final companion object Companion : R|kotlin/Any| { + private constructor(): R|E.Companion| { + super() + } + + public final val f: R|() -> kotlin/Unit| = fun (): R|kotlin/Unit| { + Unit + } + + public get(): R|() -> kotlin/Unit| + + } + + } + public final fun main(): R|kotlin/Unit| { + Q|E|.R|/E.Companion.f|.R|FakeOverride|() + Q|E.f|.R|/E.f.invoke|() + }