[FIR] ScopeClassDeclaration: introduce new property to avoid container clash
^KTIJ-23547 ^KTIJ-24141
This commit is contained in:
committed by
Space Team
parent
6635ec33d9
commit
0420be603f
+4
-2
@@ -224,6 +224,7 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() {
|
||||
result: TypeResolutionResult,
|
||||
areBareTypesAllowed: Boolean,
|
||||
topContainer: FirDeclaration?,
|
||||
containerDeclaration: FirDeclaration?,
|
||||
isOperandOfIsOperator: Boolean
|
||||
): ConeKotlinType {
|
||||
|
||||
@@ -362,7 +363,7 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() {
|
||||
return symbol.constructType(
|
||||
resultingArguments,
|
||||
typeRef.isMarkedNullable,
|
||||
typeRef.annotations.computeTypeAttributes(session, containerDeclaration = topContainer)
|
||||
typeRef.annotations.computeTypeAttributes(session, containerDeclaration = containerDeclaration)
|
||||
).also {
|
||||
val lookupTag = it.lookupTag
|
||||
if (lookupTag is ConeClassLikeLookupTagImpl && symbol is FirClassLikeSymbol<*>) {
|
||||
@@ -525,7 +526,8 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() {
|
||||
result,
|
||||
areBareTypesAllowed,
|
||||
scopeClassDeclaration.topContainer ?: scopeClassDeclaration.containingDeclarations.lastOrNull(),
|
||||
isOperandOfIsOperator
|
||||
scopeClassDeclaration.containerDeclaration,
|
||||
isOperandOfIsOperator,
|
||||
) to (result as? TypeResolutionResult.Resolved)?.typeCandidate?.diagnostic
|
||||
}
|
||||
is FirFunctionTypeRef -> createFunctionalType(typeRef) to null
|
||||
|
||||
+4
-2
@@ -25,7 +25,9 @@ import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeTypeParameterSupertype
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.firProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider
|
||||
import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.LocalClassesNavigationInfo
|
||||
import org.jetbrains.kotlin.fir.scopes.*
|
||||
import org.jetbrains.kotlin.fir.scopes.FirScope
|
||||
import org.jetbrains.kotlin.fir.scopes.createImportingScopes
|
||||
import org.jetbrains.kotlin.fir.scopes.getNestedClassifierScope
|
||||
import org.jetbrains.kotlin.fir.scopes.impl.FirMemberTypeParameterScope
|
||||
import org.jetbrains.kotlin.fir.scopes.impl.nestedClassifierScope
|
||||
import org.jetbrains.kotlin.fir.scopes.impl.wrapNestedClassifierScopeWithSubstitutionForSuperType
|
||||
@@ -361,7 +363,7 @@ open class FirSupertypeResolverVisitor(
|
||||
val resolvedTypesRefs = transformer.withFile(useSiteFile) {
|
||||
resolveSuperTypeRefs(
|
||||
transformer,
|
||||
ScopeClassDeclaration(scopes, classDeclarationsStack, classLikeDeclaration),
|
||||
ScopeClassDeclaration(scopes, classDeclarationsStack, containerDeclaration = classLikeDeclaration),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -228,7 +228,7 @@ open class FirTypeResolveTransformer(
|
||||
return typeResolverTransformer.withFile(currentFile) {
|
||||
typeRef.transform(
|
||||
typeResolverTransformer,
|
||||
ScopeClassDeclaration(towerScope, classDeclarationsStack, currentDeclaration)
|
||||
ScopeClassDeclaration(towerScope, classDeclarationsStack, containerDeclaration = currentDeclaration)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -11,5 +11,6 @@ import org.jetbrains.kotlin.fir.scopes.FirScope
|
||||
data class ScopeClassDeclaration(
|
||||
val scopes: List<FirScope>,
|
||||
val containingDeclarations: List<FirDeclaration>,
|
||||
val topContainer: FirDeclaration? = null
|
||||
)
|
||||
val topContainer: FirDeclaration? = null,
|
||||
val containerDeclaration: FirDeclaration? = null,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user