[FIR] Init packageFqName when calculating lazy arguments of anotations
^KT-58584 fixed Merge-request: KT-MR-10113 Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
This commit is contained in:
+3
-1
@@ -71,7 +71,9 @@ private fun replaceValueParameterDefaultValues(valueParameters: List<FirValuePar
|
|||||||
private fun calculateLazyArgumentsForAnnotation(annotationCall: FirAnnotationCall, session: FirSession) {
|
private fun calculateLazyArgumentsForAnnotation(annotationCall: FirAnnotationCall, session: FirSession) {
|
||||||
require(needCalculatingAnnotationCall(annotationCall))
|
require(needCalculatingAnnotationCall(annotationCall))
|
||||||
val builder = RawFirBuilder(session, baseScopeProvider = session.kotlinScopeProvider)
|
val builder = RawFirBuilder(session, baseScopeProvider = session.kotlinScopeProvider)
|
||||||
val newAnnotationCall = builder.buildAnnotationCall(annotationCall.psi as KtAnnotationEntry)
|
val ktAnnotationEntry = annotationCall.psi as KtAnnotationEntry
|
||||||
|
builder.context.packageFqName = ktAnnotationEntry.containingKtFile.packageFqName
|
||||||
|
val newAnnotationCall = builder.buildAnnotationCall(ktAnnotationEntry)
|
||||||
annotationCall.replaceArgumentList(newAnnotationCall.argumentList)
|
annotationCall.replaceArgumentList(newAnnotationCall.argumentList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
@@ -0,0 +1,4 @@
|
|||||||
|
@Anno(fun a() : String {
|
||||||
|
|
||||||
|
}())
|
||||||
|
class Top<caret>LevelClass
|
||||||
Vendored
+145
@@ -0,0 +1,145 @@
|
|||||||
|
RAW_FIR:
|
||||||
|
FILE: [ResolvedTo(RAW_FIR)] annotationWithNamedFunctionArgument.kt
|
||||||
|
[ResolvedTo(RAW_FIR)] annotations container
|
||||||
|
@Anno[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(RAW_FIR)] class TopLevelClass : R|kotlin/Any| {
|
||||||
|
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=TopLevelClass] constructor(): R|TopLevelClass| {
|
||||||
|
LAZY_super<R|kotlin/Any|>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
IMPORTS:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] annotationWithNamedFunctionArgument.kt
|
||||||
|
[ResolvedTo(RAW_FIR)] annotations container
|
||||||
|
@Anno[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(RAW_FIR)] class TopLevelClass : R|kotlin/Any| {
|
||||||
|
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=TopLevelClass] constructor(): R|TopLevelClass| {
|
||||||
|
LAZY_super<R|kotlin/Any|>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
COMPILER_REQUIRED_ANNOTATIONS:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] annotationWithNamedFunctionArgument.kt
|
||||||
|
[ResolvedTo(RAW_FIR)] annotations container
|
||||||
|
@Anno[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] class TopLevelClass : R|kotlin/Any| {
|
||||||
|
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=TopLevelClass] constructor(): R|TopLevelClass| {
|
||||||
|
LAZY_super<R|kotlin/Any|>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
COMPANION_GENERATION:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] annotationWithNamedFunctionArgument.kt
|
||||||
|
[ResolvedTo(RAW_FIR)] annotations container
|
||||||
|
@Anno[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(COMPANION_GENERATION)] class TopLevelClass : R|kotlin/Any| {
|
||||||
|
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=TopLevelClass] constructor(): R|TopLevelClass| {
|
||||||
|
LAZY_super<R|kotlin/Any|>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SUPER_TYPES:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] annotationWithNamedFunctionArgument.kt
|
||||||
|
[ResolvedTo(RAW_FIR)] annotations container
|
||||||
|
@Anno[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(SUPER_TYPES)] class TopLevelClass : R|kotlin/Any| {
|
||||||
|
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=TopLevelClass] constructor(): R|TopLevelClass| {
|
||||||
|
LAZY_super<R|kotlin/Any|>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TYPES:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] annotationWithNamedFunctionArgument.kt
|
||||||
|
[ResolvedTo(RAW_FIR)] annotations container
|
||||||
|
@<ERROR TYPE REF: Symbol not found for Anno>[Types](LAZY_EXPRESSION) public? final? [ResolvedTo(TYPES)] class TopLevelClass : R|kotlin/Any| {
|
||||||
|
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=TopLevelClass] constructor(): R|TopLevelClass| {
|
||||||
|
LAZY_super<R|kotlin/Any|>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
STATUS:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] annotationWithNamedFunctionArgument.kt
|
||||||
|
[ResolvedTo(RAW_FIR)] annotations container
|
||||||
|
@<ERROR TYPE REF: Symbol not found for Anno>[Types](LAZY_EXPRESSION) public final [ResolvedTo(STATUS)] class TopLevelClass : R|kotlin/Any| {
|
||||||
|
public [ResolvedTo(STATUS)] [ContainingClassKey=TopLevelClass] constructor(): R|TopLevelClass| {
|
||||||
|
LAZY_super<R|kotlin/Any|>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
EXPECT_ACTUAL_MATCHING:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] annotationWithNamedFunctionArgument.kt
|
||||||
|
[ResolvedTo(RAW_FIR)] annotations container
|
||||||
|
@<ERROR TYPE REF: Symbol not found for Anno>[Types](LAZY_EXPRESSION) public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] class TopLevelClass : R|kotlin/Any| {
|
||||||
|
public [ResolvedTo(STATUS)] [ContainingClassKey=TopLevelClass] constructor(): R|TopLevelClass| {
|
||||||
|
LAZY_super<R|kotlin/Any|>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ARGUMENTS_OF_ANNOTATIONS:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] annotationWithNamedFunctionArgument.kt
|
||||||
|
[ResolvedTo(RAW_FIR)] annotations container
|
||||||
|
@<ERROR TYPE REF: Symbol not found for Anno>[Types](ERROR_EXPR(Incorrect invoke receiver)local final? [ResolvedTo(RAW_FIR)] fun a(): String {
|
||||||
|
}
|
||||||
|
.invoke#()) public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] class TopLevelClass : R|kotlin/Any| {
|
||||||
|
public [ResolvedTo(STATUS)] [ContainingClassKey=TopLevelClass] constructor(): R|TopLevelClass| {
|
||||||
|
LAZY_super<R|kotlin/Any|>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CONTRACTS:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] annotationWithNamedFunctionArgument.kt
|
||||||
|
[ResolvedTo(RAW_FIR)] annotations container
|
||||||
|
@<ERROR TYPE REF: Symbol not found for Anno>[Types](ERROR_EXPR(Incorrect invoke receiver)local final? [ResolvedTo(RAW_FIR)] fun a(): String {
|
||||||
|
}
|
||||||
|
.invoke#()) public final [ResolvedTo(CONTRACTS)] class TopLevelClass : R|kotlin/Any| {
|
||||||
|
public [ResolvedTo(STATUS)] [ContainingClassKey=TopLevelClass] constructor(): R|TopLevelClass| {
|
||||||
|
LAZY_super<R|kotlin/Any|>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
IMPLICIT_TYPES_BODY_RESOLVE:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] annotationWithNamedFunctionArgument.kt
|
||||||
|
[ResolvedTo(RAW_FIR)] annotations container
|
||||||
|
@<ERROR TYPE REF: Symbol not found for Anno>[Types](ERROR_EXPR(Incorrect invoke receiver)local final? [ResolvedTo(RAW_FIR)] fun a(): String {
|
||||||
|
}
|
||||||
|
.invoke#()) public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] class TopLevelClass : R|kotlin/Any| {
|
||||||
|
public [ResolvedTo(STATUS)] [ContainingClassKey=TopLevelClass] constructor(): R|TopLevelClass| {
|
||||||
|
LAZY_super<R|kotlin/Any|>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
ANNOTATIONS_ARGUMENTS_MAPPING:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] annotationWithNamedFunctionArgument.kt
|
||||||
|
[ResolvedTo(RAW_FIR)] annotations container
|
||||||
|
@<ERROR TYPE REF: Symbol not found for Anno>[Types]() public final [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] class TopLevelClass : R|kotlin/Any| {
|
||||||
|
public [ResolvedTo(STATUS)] [ContainingClassKey=TopLevelClass] constructor(): R|TopLevelClass| {
|
||||||
|
LAZY_super<R|kotlin/Any|>
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BODY_RESOLVE:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] annotationWithNamedFunctionArgument.kt
|
||||||
|
[ResolvedTo(RAW_FIR)] annotations container
|
||||||
|
@<ERROR TYPE REF: Symbol not found for Anno>[Types]() public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|kotlin/Any| {
|
||||||
|
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|TopLevelClass| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
FILE RAW TO BODY:
|
||||||
|
FILE: [ResolvedTo(IMPORTS)] annotationWithNamedFunctionArgument.kt
|
||||||
|
[ResolvedTo(BODY_RESOLVE)] annotations container
|
||||||
|
@<ERROR TYPE REF: Symbol not found for Anno>[Types]() public final [ResolvedTo(BODY_RESOLVE)] class TopLevelClass : R|kotlin/Any| {
|
||||||
|
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=TopLevelClass] constructor(): R|TopLevelClass| {
|
||||||
|
super<R|kotlin/Any|>()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+6
@@ -523,6 +523,12 @@ public class FirOutOfContentRootLazyDeclarationResolveTestGenerated extends Abst
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/lazyResolve/errors"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/lazyResolve/errors"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("annotationWithNamedFunctionArgument.kt")
|
||||||
|
public void testAnnotationWithNamedFunctionArgument() throws Exception {
|
||||||
|
runTest("analysis/low-level-api-fir/testdata/lazyResolve/errors/annotationWithNamedFunctionArgument.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("anonymousObjectInInvalidPosition.kt")
|
@TestMetadata("anonymousObjectInInvalidPosition.kt")
|
||||||
public void testAnonymousObjectInInvalidPosition() throws Exception {
|
public void testAnonymousObjectInInvalidPosition() throws Exception {
|
||||||
|
|||||||
+6
@@ -523,6 +523,12 @@ public class FirSourceLazyDeclarationResolveTestGenerated extends AbstractFirSou
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/lazyResolve/errors"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/lazyResolve/errors"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("annotationWithNamedFunctionArgument.kt")
|
||||||
|
public void testAnnotationWithNamedFunctionArgument() throws Exception {
|
||||||
|
runTest("analysis/low-level-api-fir/testdata/lazyResolve/errors/annotationWithNamedFunctionArgument.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("anonymousObjectInInvalidPosition.kt")
|
@TestMetadata("anonymousObjectInInvalidPosition.kt")
|
||||||
public void testAnonymousObjectInInvalidPosition() throws Exception {
|
public void testAnonymousObjectInInvalidPosition() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user