[FIR-IDE] Ignore FirMemberTypeParameterScope in KtScopes

This commit is contained in:
Pavel Kirpichenkov
2020-09-01 15:24:50 +03:00
parent dc538d420e
commit f229ae413d
2 changed files with 5 additions and 41 deletions
@@ -132,9 +132,9 @@ internal class KtFirScopeProvider(
@OptIn(ExperimentalStdlibApi::class) @OptIn(ExperimentalStdlibApi::class)
val allKtScopes = buildList { val allKtScopes = buildList {
implicitReceiverScopes.mapTo(this, ::convertToKtScope) implicitReceiverScopes.mapNotNullTo(this, ::convertToKtScope)
nonLocalScopes.mapTo(this, ::convertToKtScope) nonLocalScopes.mapNotNullTo(this, ::convertToKtScope)
firLocalScopes.mapTo(this, ::convertToKtScope) firLocalScopes.mapNotNullTo(this, ::convertToKtScope)
} }
KtScopeContext(getCompositeScope(allKtScopes), implicitReceiversTypes) KtScopeContext(getCompositeScope(allKtScopes), implicitReceiversTypes)
@@ -145,14 +145,14 @@ internal class KtFirScopeProvider(
?.getNonStrictParentOfType<KtNamedFunction>() ?.getNonStrictParentOfType<KtNamedFunction>()
?.takeIf { it.textOffset == offset } ?.takeIf { it.textOffset == offset }
private fun convertToKtScope(firScope: FirScope): KtScope { private fun convertToKtScope(firScope: FirScope): KtScope? {
firScopeStorage.register(firScope) firScopeStorage.register(firScope)
return when (firScope) { return when (firScope) {
is FirAbstractSimpleImportingScope -> KtFirNonStarImportingScope(firScope, builder, token) is FirAbstractSimpleImportingScope -> KtFirNonStarImportingScope(firScope, builder, token)
is FirAbstractStarImportingScope -> KtFirStarImportingScope(firScope, builder, project, token) is FirAbstractStarImportingScope -> KtFirStarImportingScope(firScope, builder, project, token)
is FirPackageMemberScope -> KtFirPackageScope(firScope, project, builder, token) is FirPackageMemberScope -> KtFirPackageScope(firScope, project, builder, token)
is FirContainingNamesAwareScope -> KtFirDelegatingScopeImpl(firScope, builder, token) is FirContainingNamesAwareScope -> KtFirDelegatingScopeImpl(firScope, builder, token)
is FirMemberTypeParameterScope -> KtFirMemberTypeParameterStubbingScope(firScope, token) is FirMemberTypeParameterScope -> null
else -> TODO(firScope::class.toString()) else -> TODO(firScope::class.toString())
} }
} }
@@ -1,36 +0,0 @@
/*
* Copyright 2010-2020 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.idea.frontend.api.fir.scopes
import org.jetbrains.kotlin.fir.scopes.impl.FirMemberTypeParameterScope
import org.jetbrains.kotlin.idea.frontend.api.ValidityToken
import org.jetbrains.kotlin.idea.frontend.api.scopes.KtScope
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassLikeSymbol
import org.jetbrains.kotlin.name.Name
// Does nothing, it is used to close the hole in KtFirScopeProvider
// TODO: check if this scope should provide something useful
class KtFirMemberTypeParameterStubbingScope(
val firMemberTypeParameterScope: FirMemberTypeParameterScope,
override val token: ValidityToken,
) : KtScope {
override fun getCallableNames(): Set<Name> {
return emptySet()
}
override fun getClassLikeSymbolNames(): Set<Name> {
return emptySet()
}
override fun getCallableSymbols(): Sequence<KtCallableSymbol> {
return emptySequence()
}
override fun getClassClassLikeSymbols(): Sequence<KtClassLikeSymbol> {
return emptySequence()
}
}