[LL FIR] LLFirTargetResolver: do not resolve file annotation container before each declaration
We don't have to resolve `FirFileAnnotationsContainer` before each declaration. This became possible after KT-65345 as now `FirDesignation` has `FirFile` in its path so, `PersistenceContextCollector#collectContext` resolves it as well as we don't have problems with unresolved annotations during diagnostics processing ^KT-65876
This commit is contained in:
committed by
Space Team
parent
dc898fdf5c
commit
fe4ead751f
+4
-3
@@ -13,7 +13,6 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.errorWithFirSpecificEntries
|
||||
import org.jetbrains.kotlin.fir.FirElement
|
||||
import org.jetbrains.kotlin.fir.FirElementWithResolveState
|
||||
import org.jetbrains.kotlin.fir.FirFileAnnotationsContainer
|
||||
import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration
|
||||
import org.jetbrains.kotlin.fir.declarations.FirConstructor
|
||||
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
|
||||
@@ -135,8 +134,7 @@ internal abstract class LLFirTargetResolver(
|
||||
* @see skipDependencyTargetResolutionStep
|
||||
*/
|
||||
private fun resolveDependencies(target: FirElementWithResolveState) {
|
||||
if (skipDependencyTargetResolutionStep || target is FirFileAnnotationsContainer) return
|
||||
resolveTarget.firFile?.annotationsContainer?.lazyResolveToPhase(resolverPhase)
|
||||
if (skipDependencyTargetResolutionStep) return
|
||||
|
||||
val originalDeclaration = (target as? FirCallableDeclaration)?.originalIfFakeOverrideOrDelegated()
|
||||
when {
|
||||
@@ -160,6 +158,9 @@ internal abstract class LLFirTargetResolver(
|
||||
target is FirField && target.origin == FirDeclarationOrigin.Synthetic.DelegateField || target is FirConstructor -> {
|
||||
containingClass(target).lazyResolveToPhase(resolverPhase)
|
||||
}
|
||||
|
||||
// Effectively, file annotation container is a part of FirFile, so we have to resolve it before
|
||||
target is FirFile -> target.annotationsContainer?.lazyResolveToPhase(resolverPhase)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+17
-17
@@ -13,64 +13,64 @@ FILE: [ResolvedTo(IMPORTS)] annotations.kt
|
||||
COMPILER_REQUIRED_ANNOTATIONS:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotations.kt
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] annotations container
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
@Suppress[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
COMPANION_GENERATION:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotations.kt
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(COMPANION_GENERATION)] annotations container
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
@Suppress[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(COMPANION_GENERATION)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
SUPER_TYPES:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotations.kt
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(SUPER_TYPES)] annotations container
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
@Suppress[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(SUPER_TYPES)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
TYPES:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotations.kt
|
||||
@FILE:R|kotlin/Suppress|[Types](LAZY_EXPRESSION)
|
||||
[ResolvedTo(TYPES)] annotations container
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
@R|kotlin/Suppress|[Types](LAZY_EXPRESSION) public? final? [ResolvedTo(TYPES)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
STATUS:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotations.kt
|
||||
@FILE:R|kotlin/Suppress|[Types](LAZY_EXPRESSION)
|
||||
[ResolvedTo(STATUS)] annotations container
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
@R|kotlin/Suppress|[Types](LAZY_EXPRESSION) public final [ResolvedTo(STATUS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
EXPECT_ACTUAL_MATCHING:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotations.kt
|
||||
@FILE:R|kotlin/Suppress|[Types](LAZY_EXPRESSION)
|
||||
[ResolvedTo(EXPECT_ACTUAL_MATCHING)] annotations container
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
@R|kotlin/Suppress|[Types](LAZY_EXPRESSION) public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||
|
||||
CONTRACTS:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotations.kt
|
||||
@FILE:R|kotlin/Suppress|[Types](LAZY_EXPRESSION)
|
||||
[ResolvedTo(CONTRACTS)] annotations container
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
@R|kotlin/Suppress|[Types](LAZY_EXPRESSION) public final [ResolvedTo(CONTRACTS)] fun resolveMe(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
IMPLICIT_TYPES_BODY_RESOLVE:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotations.kt
|
||||
@FILE:R|kotlin/Suppress|[Types](LAZY_EXPRESSION)
|
||||
[ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] annotations container
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
@R|kotlin/Suppress|[Types](LAZY_EXPRESSION) public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
ANNOTATION_ARGUMENTS:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotations.kt
|
||||
@FILE:R|kotlin/Suppress|[Types](names = vararg(String(1)))
|
||||
[ResolvedTo(ANNOTATION_ARGUMENTS)] annotations container
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
@R|kotlin/Suppress|[Types](names = vararg(String(2))) public final [ResolvedTo(ANNOTATION_ARGUMENTS)] fun resolveMe(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
BODY_RESOLVE:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotations.kt
|
||||
@FILE:R|kotlin/Suppress|[Types](names = vararg(String(1)))
|
||||
[ResolvedTo(ANNOTATION_ARGUMENTS)] annotations container
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
@R|kotlin/Suppress|[Types](names = vararg(String(2))) public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
COMPILER_REQUIRED_ANNOTATIONS:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] annotations container
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
context(<script>@kotlin.script.templates.standard.ScriptTemplateWithArgs)
|
||||
SCRIPT: [ResolvedTo(RAW_FIR)] <script-annotationsScript.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
@@ -34,7 +34,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
COMPANION_GENERATION:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(COMPANION_GENERATION)] annotations container
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
context(<script>@kotlin.script.templates.standard.ScriptTemplateWithArgs)
|
||||
SCRIPT: [ResolvedTo(RAW_FIR)] <script-annotationsScript.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
@@ -45,7 +45,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
SUPER_TYPES:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(SUPER_TYPES)] annotations container
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
context(<script>@kotlin.script.templates.standard.ScriptTemplateWithArgs)
|
||||
SCRIPT: [ResolvedTo(RAW_FIR)] <script-annotationsScript.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
@@ -55,8 +55,8 @@ FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
|
||||
TYPES:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
@FILE:R|kotlin/Suppress|[Types](LAZY_EXPRESSION)
|
||||
[ResolvedTo(TYPES)] annotations container
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
context(<script>@kotlin.script.templates.standard.ScriptTemplateWithArgs)
|
||||
SCRIPT: [ResolvedTo(RAW_FIR)] <script-annotationsScript.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
@@ -66,8 +66,8 @@ FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
|
||||
STATUS:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
@FILE:R|kotlin/Suppress|[Types](LAZY_EXPRESSION)
|
||||
[ResolvedTo(STATUS)] annotations container
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
context(<script>@kotlin.script.templates.standard.ScriptTemplateWithArgs)
|
||||
SCRIPT: [ResolvedTo(RAW_FIR)] <script-annotationsScript.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
@@ -77,8 +77,8 @@ FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
|
||||
EXPECT_ACTUAL_MATCHING:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
@FILE:R|kotlin/Suppress|[Types](LAZY_EXPRESSION)
|
||||
[ResolvedTo(EXPECT_ACTUAL_MATCHING)] annotations container
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
context(<script>@kotlin.script.templates.standard.ScriptTemplateWithArgs)
|
||||
SCRIPT: [ResolvedTo(RAW_FIR)] <script-annotationsScript.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
@@ -88,8 +88,8 @@ FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
|
||||
CONTRACTS:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
@FILE:R|kotlin/Suppress|[Types](LAZY_EXPRESSION)
|
||||
[ResolvedTo(CONTRACTS)] annotations container
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||
SCRIPT: [ResolvedTo(TYPES)] <script-annotationsScript.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
@@ -100,8 +100,8 @@ FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
|
||||
IMPLICIT_TYPES_BODY_RESOLVE:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
@FILE:R|kotlin/Suppress|[Types](LAZY_EXPRESSION)
|
||||
[ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] annotations container
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||
SCRIPT: [ResolvedTo(TYPES)] <script-annotationsScript.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
@@ -112,8 +112,8 @@ FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
|
||||
ANNOTATION_ARGUMENTS:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
@FILE:R|kotlin/Suppress|[Types](names = vararg(String(1)))
|
||||
[ResolvedTo(ANNOTATION_ARGUMENTS)] annotations container
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||
SCRIPT: [ResolvedTo(TYPES)] <script-annotationsScript.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
@@ -124,8 +124,8 @@ FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
|
||||
BODY_RESOLVE:
|
||||
FILE: [ResolvedTo(IMPORTS)] annotationsScript.kts
|
||||
@FILE:R|kotlin/Suppress|[Types](names = vararg(String(1)))
|
||||
[ResolvedTo(ANNOTATION_ARGUMENTS)] annotations container
|
||||
@FILE:Suppress[Unresolved](LAZY_EXPRESSION)
|
||||
[ResolvedTo(RAW_FIR)] annotations container
|
||||
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
|
||||
SCRIPT: [ResolvedTo(TYPES)] <script-annotationsScript.kts>
|
||||
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
|
||||
|
||||
Reference in New Issue
Block a user