[AA] Flatten composite scopes when building scope context for position
^KTIJ-25048 Fixed
This commit is contained in:
committed by
Space Team
parent
1c72ce173f
commit
b23dbd359f
+6
@@ -1274,6 +1274,12 @@ public class Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exte
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalEnumEntry.kt")
|
||||
public void testSelfNonLocalEnumEntry() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalEnumEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalMethod.kt")
|
||||
public void testSelfNonLocalMethod() throws Exception {
|
||||
|
||||
+8
-1
@@ -193,7 +193,8 @@ internal class KtFirScopeProvider(
|
||||
}
|
||||
|
||||
val firScopes = towerDataElementsIndexed.flatMap { (index, towerDataElement) ->
|
||||
towerDataElement.getAvailableScopes().map { IndexedValue(index, it) }
|
||||
val availableScopes = towerDataElement.getAvailableScopes().flatMap { flattenFirScope(it) }
|
||||
availableScopes.map { IndexedValue(index, it) }
|
||||
}
|
||||
val scopes = firScopes.map { (index, firScope) ->
|
||||
KtScopeWithKind(convertToKtScope(firScope), getScopeKind(firScope, index), token)
|
||||
@@ -202,6 +203,12 @@ internal class KtFirScopeProvider(
|
||||
return KtScopeContext(scopes, implicitReceivers, token)
|
||||
}
|
||||
|
||||
private fun flattenFirScope(firScope: FirScope): List<FirScope> = when (firScope) {
|
||||
is FirCompositeScope -> firScope.scopes.flatMap { flattenFirScope(it) }
|
||||
is FirNameAwareCompositeScope -> firScope.scopes.flatMap { flattenFirScope(it) }
|
||||
else -> listOf(firScope)
|
||||
}
|
||||
|
||||
private fun convertToKtScope(firScope: FirScope): KtScope {
|
||||
return when (firScope) {
|
||||
is FirAbstractSimpleImportingScope -> KtFirNonStarImportingScope(firScope, builder)
|
||||
|
||||
+6
@@ -1274,6 +1274,12 @@ public class FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated ex
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalEnumEntry.kt")
|
||||
public void testSelfNonLocalEnumEntry() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalEnumEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalMethod.kt")
|
||||
public void testSelfNonLocalMethod() throws Exception {
|
||||
|
||||
+6
@@ -1158,6 +1158,12 @@ public class FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerate
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalEnumEntry.kt")
|
||||
public void testSelfNonLocalEnumEntry() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalEnumEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalMethod.kt")
|
||||
public void testSelfNonLocalMethod() throws Exception {
|
||||
|
||||
+6
@@ -1274,6 +1274,12 @@ public class FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exten
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalEnumEntry.kt")
|
||||
public void testSelfNonLocalEnumEntry() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalEnumEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalMethod.kt")
|
||||
public void testSelfNonLocalMethod() throws Exception {
|
||||
|
||||
+6
@@ -1274,6 +1274,12 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerate
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfLocalProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalEnumEntry.kt")
|
||||
public void testSelfNonLocalEnumEntry() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/referenceResolve/kDoc/localContext/SelfNonLocalEnumEntry.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("SelfNonLocalMethod.kt")
|
||||
public void testSelfNonLocalMethod() throws Exception {
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
enum class E {
|
||||
/**
|
||||
* [A<caret>A]
|
||||
*/
|
||||
AA, BB;
|
||||
|
||||
companion object {
|
||||
fun f() {}
|
||||
}
|
||||
}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
Resolved to:
|
||||
0: (in E) AA
|
||||
Reference in New Issue
Block a user