[FIR] Fix resolution of objects in presence of low-priority candidates

For CallKind.VariableAccess, the condition when to *skip* resolution of
objects was previously collector.isSuccess. This wasn't strict enough
because collector.isSuccess could be true when the best found candidate
has an applicability like RESOLVED_WITH_LOW_PRIORITY (e.g. from dynamic
scope or annotated with @LowPriorityInOverloadResolution). In these
cases, we do want to resolve objects. To fix this, the condition is
changed to collector.shouldStopResolve which is stricter.

#KT-57960 Fixed
This commit is contained in:
Kirill Rakhman
2023-04-17 18:31:50 +02:00
committed by Space Team
parent bc7aea1426
commit 8b47a4fa48
14 changed files with 228 additions and 2 deletions
@@ -0,0 +1,37 @@
// FIR_IDENTICAL
// DIAGNOSTICS: -EXTENSION_SHADOWED_BY_MEMBER
// FILE: a.kt
package a
val bar get() = ""
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@kotlin.internal.LowPriorityInOverloadResolution
val baz get() = ""
// FILE: b.kt
package b
object bar
object baz {
val qux = 1
}
// FILE: test.kt
import a.*
import b.*
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
class Foo {
@kotlin.internal.LowPriorityInOverloadResolution
val bar = 1
@kotlin.internal.LowPriorityInOverloadResolution
val baz = 1
}
fun Foo.test() {
bar.length
baz.qux
}