[FIR] provide containerDeclaration to CustomAnnotationTypeAttribute for lazy resolve
tested by FirIdeNormalAnalysisSourceModuleSymbolByPsiTestGenerated.testTypeAnnotations ^KTIJ-23547 Fixed ^KTIJ-24141 Fixed
This commit is contained in:
committed by
Space Team
parent
f32483000a
commit
9d42a5cb01
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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.
|
||||
*/
|
||||
|
||||
@@ -362,7 +362,7 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() {
|
||||
return symbol.constructType(
|
||||
resultingArguments,
|
||||
typeRef.isMarkedNullable,
|
||||
typeRef.annotations.computeTypeAttributes(session)
|
||||
typeRef.annotations.computeTypeAttributes(session, containerDeclaration = topContainer)
|
||||
).also {
|
||||
val lookupTag = it.lookupTag
|
||||
if (lookupTag is ConeClassLikeLookupTagImpl && symbol is FirClassLikeSymbol<*>) {
|
||||
|
||||
+16
-1
@@ -60,6 +60,17 @@ open class FirTypeResolveTransformer(
|
||||
) : FirAbstractTreeTransformer<Any?>(FirResolvePhase.TYPES) {
|
||||
private val scopes = mutableListOf<FirScope>()
|
||||
private val towerScope = scopes.asReversed()
|
||||
private var currentDeclaration: FirDeclaration? = null
|
||||
|
||||
private inline fun <T> withDeclaration(declaration: FirDeclaration, crossinline action: () -> T): T {
|
||||
val oldDeclaration = currentDeclaration
|
||||
return try {
|
||||
currentDeclaration = declaration
|
||||
action()
|
||||
} finally {
|
||||
currentDeclaration = oldDeclaration
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
scopes.addAll(initialScopes.asReversed())
|
||||
@@ -208,11 +219,15 @@ open class FirTypeResolveTransformer(
|
||||
return implicitTypeRef
|
||||
}
|
||||
|
||||
override fun transformDeclaration(declaration: FirDeclaration, data: Any?): FirDeclaration = withDeclaration(declaration) {
|
||||
super.transformDeclaration(declaration, data)
|
||||
}
|
||||
|
||||
override fun transformTypeRef(typeRef: FirTypeRef, data: Any?): FirResolvedTypeRef {
|
||||
return typeResolverTransformer.withFile(currentFile) {
|
||||
typeRef.transform(
|
||||
typeResolverTransformer,
|
||||
ScopeClassDeclaration(towerScope, classDeclarationsStack)
|
||||
ScopeClassDeclaration(towerScope, classDeclarationsStack, currentDeclaration)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user