FIR: Fix bug with incorrect source element for qualifiers

This commit is contained in:
Roman Golyshev
2020-12-01 22:03:38 +03:00
committed by Space
parent 1479388bd5
commit 108395fcfe
7 changed files with 33 additions and 2 deletions
@@ -144,6 +144,11 @@ public class FirReferenceResolveTestGenerated extends AbstractFirReferenceResolv
runTest("idea/testData/resolve/references/EnumValues.kt");
}
@TestMetadata("ExternalCompanionObject.kt")
public void testExternalCompanionObject() throws Exception {
runTest("idea/testData/resolve/references/ExternalCompanionObject.kt");
}
@TestMetadata("FakeJavaLang1.kt")
public void testFakeJavaLang1() throws Exception {
runTest("idea/testData/resolve/references/FakeJavaLang1.kt");
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.references
import com.intellij.psi.tree.TokenSet
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.ROOT_PREFIX_FOR_IDE_RESOLUTION_MODE
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty
import org.jetbrains.kotlin.fir.expressions.*
@@ -121,6 +122,7 @@ internal object FirReferenceResolveHelper {
else -> {
qualified
.collectDescendantsOfType<KtSimpleNameExpression>()
.dropWhile { it.getReferencedName() == ROOT_PREFIX_FOR_IDE_RESOLUTION_MODE }
.joinToString(separator = ".") { it.getReferencedName() }
.let(::FqName)
}
@@ -0,0 +1,5 @@
package dependency
class C {
companion object
}
@@ -0,0 +1,5 @@
fun usage() {
dependency.C.<caret>Companion
}
// REF: companion object of (dependency).C
@@ -144,6 +144,11 @@ public class ReferenceResolveTestGenerated extends AbstractReferenceResolveTest
runTest("idea/testData/resolve/references/EnumValues.kt");
}
@TestMetadata("ExternalCompanionObject.kt")
public void testExternalCompanionObject() throws Exception {
runTest("idea/testData/resolve/references/ExternalCompanionObject.kt");
}
@TestMetadata("FakeJavaLang1.kt")
public void testFakeJavaLang1() throws Exception {
runTest("idea/testData/resolve/references/FakeJavaLang1.kt");