K2: Adjust Analysis API to the recent scope structure changes
Namely, in the previous commit we merged two (LOW and HIGH priority default start import scopes) into the single one For more explanations, please look at the previous commit
This commit is contained in:
committed by
Space Team
parent
01354c8ce5
commit
78e2d53f3c
+1
@@ -233,6 +233,7 @@ internal class KtFirScopeProvider(
|
||||
return when (firScope) {
|
||||
is FirAbstractSimpleImportingScope -> KtFirNonStarImportingScope(firScope, builder)
|
||||
is FirAbstractStarImportingScope -> KtFirStarImportingScope(firScope, analysisSession)
|
||||
is FirDefaultStarImportingScope -> KtFirDefaultStarImportingScope(firScope, analysisSession)
|
||||
is FirPackageMemberScope -> createPackageScope(firScope.fqName)
|
||||
is FirContainingNamesAwareScope -> KtFirDelegatingNamesAwareScope(firScope, builder)
|
||||
else -> TODO(firScope::class.toString())
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.fir.scopes
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.fir.KtFirAnalysisSession
|
||||
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
|
||||
import org.jetbrains.kotlin.analysis.api.scopes.KtScopeNameFilter
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtConstructorSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtPackageSymbol
|
||||
import org.jetbrains.kotlin.fir.scopes.impl.FirDefaultStarImportingScope
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
|
||||
internal class KtFirDefaultStarImportingScope(
|
||||
firScope: FirDefaultStarImportingScope,
|
||||
analysisSession: KtFirAnalysisSession,
|
||||
) : KtFirBasedScope<FirDefaultStarImportingScope>(firScope, analysisSession.firSymbolBuilder) {
|
||||
|
||||
private val firstWrappedScope = KtFirStarImportingScope(firScope.first, analysisSession)
|
||||
private val secondWrappedScope = KtFirStarImportingScope(firScope.second, analysisSession)
|
||||
|
||||
override fun getPackageSymbols(nameFilter: KtScopeNameFilter): Sequence<KtPackageSymbol> = withValidityAssertion {
|
||||
emptySequence()
|
||||
}
|
||||
|
||||
override fun getConstructors(): Sequence<KtConstructorSymbol> = withValidityAssertion { emptySequence() }
|
||||
|
||||
override fun getPossibleCallableNames(): Set<Name> = buildSet {
|
||||
addAll(firstWrappedScope.getPossibleCallableNames())
|
||||
addAll(secondWrappedScope.getPossibleCallableNames())
|
||||
}
|
||||
|
||||
override fun getPossibleClassifierNames(): Set<Name> = buildSet {
|
||||
addAll(firstWrappedScope.getPossibleClassifierNames())
|
||||
addAll(secondWrappedScope.getPossibleClassifierNames())
|
||||
}
|
||||
}
|
||||
analysis/analysis-api/testData/components/scopeProvider/importingScopeContext/errorImport.pretty.txt
Vendored
+5
-6
@@ -2,16 +2,15 @@ implicit receivers:
|
||||
scopes:
|
||||
DefaultStarImportingScope, index = 0
|
||||
|
||||
DefaultStarImportingScope, index = 1
|
||||
DefaultSimpleImportingScope, index = 1
|
||||
|
||||
DefaultSimpleImportingScope, index = 2
|
||||
ExplicitStarImportingScope, index = 2, empty
|
||||
|
||||
ExplicitStarImportingScope, index = 3, empty
|
||||
DefaultSimpleImportingScope, index = 3
|
||||
|
||||
DefaultSimpleImportingScope, index = 4
|
||||
|
||||
DefaultSimpleImportingScope, index = 5
|
||||
PackageMemberScope, index = 5
|
||||
|
||||
PackageMemberScope, index = 6
|
||||
ExplicitSimpleImportingScope, index = 6, empty
|
||||
|
||||
ExplicitSimpleImportingScope, index = 7, empty
|
||||
|
||||
Vendored
+5
-6
@@ -2,17 +2,16 @@ implicit receivers:
|
||||
scopes:
|
||||
DefaultStarImportingScope, index = 0
|
||||
|
||||
DefaultStarImportingScope, index = 1
|
||||
DefaultSimpleImportingScope, index = 1
|
||||
|
||||
DefaultSimpleImportingScope, index = 2
|
||||
ExplicitStarImportingScope, index = 2, empty
|
||||
|
||||
ExplicitStarImportingScope, index = 3, empty
|
||||
DefaultSimpleImportingScope, index = 3
|
||||
|
||||
DefaultSimpleImportingScope, index = 4
|
||||
|
||||
DefaultSimpleImportingScope, index = 5
|
||||
PackageMemberScope, index = 5
|
||||
|
||||
PackageMemberScope, index = 6
|
||||
ExplicitSimpleImportingScope, index = 6, empty
|
||||
|
||||
ExplicitSimpleImportingScope, index = 7, empty
|
||||
|
||||
|
||||
analysis/analysis-api/testData/components/scopeProvider/importingScopeContext/importAlias.pretty.txt
Vendored
+5
-7
@@ -2,19 +2,17 @@ implicit receivers:
|
||||
scopes:
|
||||
DefaultStarImportingScope, index = 0
|
||||
|
||||
DefaultStarImportingScope, index = 1
|
||||
DefaultSimpleImportingScope, index = 1
|
||||
|
||||
DefaultSimpleImportingScope, index = 2
|
||||
ExplicitStarImportingScope, index = 2, empty
|
||||
|
||||
ExplicitStarImportingScope, index = 3, empty
|
||||
DefaultSimpleImportingScope, index = 3
|
||||
|
||||
DefaultSimpleImportingScope, index = 4
|
||||
|
||||
DefaultSimpleImportingScope, index = 5
|
||||
PackageMemberScope, index = 5
|
||||
|
||||
PackageMemberScope, index = 6
|
||||
|
||||
ExplicitSimpleImportingScope, index = 7
|
||||
ExplicitSimpleImportingScope, index = 6
|
||||
classifiers: 1
|
||||
class A
|
||||
callables: 0
|
||||
|
||||
Vendored
+5
-7
@@ -2,19 +2,17 @@ implicit receivers:
|
||||
scopes:
|
||||
DefaultStarImportingScope, index = 0
|
||||
|
||||
DefaultStarImportingScope, index = 1
|
||||
DefaultSimpleImportingScope, index = 1
|
||||
|
||||
DefaultSimpleImportingScope, index = 2
|
||||
ExplicitStarImportingScope, index = 2, empty
|
||||
|
||||
ExplicitStarImportingScope, index = 3, empty
|
||||
DefaultSimpleImportingScope, index = 3
|
||||
|
||||
DefaultSimpleImportingScope, index = 4
|
||||
|
||||
DefaultSimpleImportingScope, index = 5
|
||||
PackageMemberScope, index = 5
|
||||
|
||||
PackageMemberScope, index = 6
|
||||
|
||||
ExplicitSimpleImportingScope, index = 7
|
||||
ExplicitSimpleImportingScope, index = 6
|
||||
classifiers: 1
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
|
||||
Vendored
+5
-6
@@ -2,16 +2,15 @@ implicit receivers:
|
||||
scopes:
|
||||
DefaultStarImportingScope, index = 0
|
||||
|
||||
DefaultStarImportingScope, index = 1
|
||||
DefaultSimpleImportingScope, index = 1
|
||||
|
||||
DefaultSimpleImportingScope, index = 2
|
||||
ExplicitStarImportingScope, index = 2, empty
|
||||
|
||||
ExplicitStarImportingScope, index = 3, empty
|
||||
DefaultSimpleImportingScope, index = 3
|
||||
|
||||
DefaultSimpleImportingScope, index = 4
|
||||
|
||||
DefaultSimpleImportingScope, index = 5
|
||||
PackageMemberScope, index = 5
|
||||
|
||||
PackageMemberScope, index = 6
|
||||
ExplicitSimpleImportingScope, index = 6, empty
|
||||
|
||||
ExplicitSimpleImportingScope, index = 7, empty
|
||||
|
||||
Vendored
+5
-6
@@ -2,17 +2,16 @@ implicit receivers:
|
||||
scopes:
|
||||
DefaultStarImportingScope, index = 0
|
||||
|
||||
DefaultStarImportingScope, index = 1
|
||||
DefaultSimpleImportingScope, index = 1
|
||||
|
||||
DefaultSimpleImportingScope, index = 2
|
||||
ExplicitStarImportingScope, index = 2, empty
|
||||
|
||||
ExplicitStarImportingScope, index = 3, empty
|
||||
DefaultSimpleImportingScope, index = 3
|
||||
|
||||
DefaultSimpleImportingScope, index = 4
|
||||
|
||||
DefaultSimpleImportingScope, index = 5
|
||||
PackageMemberScope, index = 5
|
||||
|
||||
PackageMemberScope, index = 6
|
||||
ExplicitSimpleImportingScope, index = 6, empty
|
||||
|
||||
ExplicitSimpleImportingScope, index = 7, empty
|
||||
|
||||
|
||||
+5
-7
@@ -2,19 +2,17 @@ implicit receivers:
|
||||
scopes:
|
||||
DefaultStarImportingScope, index = 0
|
||||
|
||||
DefaultStarImportingScope, index = 1
|
||||
DefaultSimpleImportingScope, index = 1
|
||||
|
||||
DefaultSimpleImportingScope, index = 2
|
||||
ExplicitStarImportingScope, index = 2, empty
|
||||
|
||||
ExplicitStarImportingScope, index = 3, empty
|
||||
DefaultSimpleImportingScope, index = 3
|
||||
|
||||
DefaultSimpleImportingScope, index = 4
|
||||
|
||||
DefaultSimpleImportingScope, index = 5
|
||||
PackageMemberScope, index = 5
|
||||
|
||||
PackageMemberScope, index = 6
|
||||
|
||||
ExplicitSimpleImportingScope, index = 7
|
||||
ExplicitSimpleImportingScope, index = 6
|
||||
classifiers: 1
|
||||
class A
|
||||
callables: 0
|
||||
|
||||
Vendored
+5
-7
@@ -2,19 +2,17 @@ implicit receivers:
|
||||
scopes:
|
||||
DefaultStarImportingScope, index = 0
|
||||
|
||||
DefaultStarImportingScope, index = 1
|
||||
DefaultSimpleImportingScope, index = 1
|
||||
|
||||
DefaultSimpleImportingScope, index = 2
|
||||
ExplicitStarImportingScope, index = 2, empty
|
||||
|
||||
ExplicitStarImportingScope, index = 3, empty
|
||||
DefaultSimpleImportingScope, index = 3
|
||||
|
||||
DefaultSimpleImportingScope, index = 4
|
||||
|
||||
DefaultSimpleImportingScope, index = 5
|
||||
PackageMemberScope, index = 5
|
||||
|
||||
PackageMemberScope, index = 6
|
||||
|
||||
ExplicitSimpleImportingScope, index = 7
|
||||
ExplicitSimpleImportingScope, index = 6
|
||||
classifiers: 1
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
|
||||
Vendored
+6
-7
@@ -2,20 +2,19 @@ implicit receivers:
|
||||
scopes:
|
||||
DefaultStarImportingScope, index = 0
|
||||
|
||||
DefaultStarImportingScope, index = 1
|
||||
DefaultSimpleImportingScope, index = 1
|
||||
|
||||
DefaultSimpleImportingScope, index = 2
|
||||
|
||||
ExplicitStarImportingScope, index = 3
|
||||
ExplicitStarImportingScope, index = 2
|
||||
classifiers: 1
|
||||
class A
|
||||
callables: 1
|
||||
fun b()
|
||||
|
||||
DefaultSimpleImportingScope, index = 3
|
||||
|
||||
DefaultSimpleImportingScope, index = 4
|
||||
|
||||
DefaultSimpleImportingScope, index = 5
|
||||
PackageMemberScope, index = 5
|
||||
|
||||
PackageMemberScope, index = 6
|
||||
ExplicitSimpleImportingScope, index = 6, empty
|
||||
|
||||
ExplicitSimpleImportingScope, index = 7, empty
|
||||
|
||||
Vendored
+6
-7
@@ -2,11 +2,9 @@ implicit receivers:
|
||||
scopes:
|
||||
DefaultStarImportingScope, index = 0
|
||||
|
||||
DefaultStarImportingScope, index = 1
|
||||
DefaultSimpleImportingScope, index = 1
|
||||
|
||||
DefaultSimpleImportingScope, index = 2
|
||||
|
||||
ExplicitStarImportingScope, index = 3
|
||||
ExplicitStarImportingScope, index = 2
|
||||
classifiers: 1
|
||||
KtNamedClassOrObjectSymbol:
|
||||
annotationsList: []
|
||||
@@ -60,11 +58,12 @@ scopes:
|
||||
valueParameters: []
|
||||
visibility: Public
|
||||
|
||||
DefaultSimpleImportingScope, index = 3
|
||||
|
||||
DefaultSimpleImportingScope, index = 4
|
||||
|
||||
DefaultSimpleImportingScope, index = 5
|
||||
PackageMemberScope, index = 5
|
||||
|
||||
PackageMemberScope, index = 6
|
||||
ExplicitSimpleImportingScope, index = 6, empty
|
||||
|
||||
ExplicitSimpleImportingScope, index = 7, empty
|
||||
|
||||
|
||||
-1
@@ -35,4 +35,3 @@ scopes:
|
||||
|
||||
DefaultStarImportingScope, index = 9
|
||||
|
||||
DefaultStarImportingScope, index = 10
|
||||
|
||||
Vendored
-1
@@ -217,4 +217,3 @@ scopes:
|
||||
|
||||
DefaultStarImportingScope, index = 9
|
||||
|
||||
DefaultStarImportingScope, index = 10
|
||||
|
||||
analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/enumEntry.pretty.txt
Vendored
-1
@@ -64,4 +64,3 @@ scopes:
|
||||
|
||||
DefaultStarImportingScope, index = 12
|
||||
|
||||
DefaultStarImportingScope, index = 13
|
||||
|
||||
Vendored
-1
@@ -792,4 +792,3 @@ scopes:
|
||||
|
||||
DefaultStarImportingScope, index = 12
|
||||
|
||||
DefaultStarImportingScope, index = 13
|
||||
|
||||
analysis/analysis-api/testData/components/scopeProvider/scopeContextForPosition/errorType.pretty.txt
Vendored
-1
@@ -47,4 +47,3 @@ scopes:
|
||||
|
||||
DefaultStarImportingScope, index = 13
|
||||
|
||||
DefaultStarImportingScope, index = 14
|
||||
|
||||
Vendored
-1
@@ -363,4 +363,3 @@ scopes:
|
||||
|
||||
DefaultStarImportingScope, index = 13
|
||||
|
||||
DefaultStarImportingScope, index = 14
|
||||
|
||||
-2
@@ -45,5 +45,3 @@ scopes:
|
||||
|
||||
DefaultStarImportingScope, index = 11
|
||||
|
||||
DefaultStarImportingScope, index = 12
|
||||
|
||||
|
||||
Vendored
-2
@@ -312,5 +312,3 @@ scopes:
|
||||
|
||||
DefaultStarImportingScope, index = 11
|
||||
|
||||
DefaultStarImportingScope, index = 12
|
||||
|
||||
|
||||
-1
@@ -101,5 +101,4 @@ scopes:
|
||||
|
||||
DefaultStarImportingScope, index = 19
|
||||
|
||||
DefaultStarImportingScope, index = 20
|
||||
|
||||
|
||||
-2
@@ -955,5 +955,3 @@ scopes:
|
||||
|
||||
DefaultStarImportingScope, index = 19
|
||||
|
||||
DefaultStarImportingScope, index = 20
|
||||
|
||||
|
||||
Reference in New Issue
Block a user