From 1c446151e7da0e7e6ac977e8298795bfe58a87ce Mon Sep 17 00:00:00 2001 From: Kirill Rakhman Date: Mon, 28 Aug 2023 13:16:54 +0200 Subject: [PATCH] [FIR] Skip resolvable package names in front of UNRESOLVED_REFERENCE #KT-55471 --- ...onClassWithJavaTarget.out_of_src_roots.txt | 18 +++++----- .../lazyResolve/annotationParameters.txt | 18 +++++----- .../annotationParametersScript.txt | 22 ++++++------- .../FirSpecificTypeResolverTransformer.kt | 33 ++++++++++++++++++- .../nativeTests/cloneableInNative.fir.kt | 2 +- .../diagnostics/tests/ResolveToJava.fir.kt | 4 +-- .../unresolvedReferenceRange.fir.kt | 5 --- .../annotations/unresolvedReferenceRange.kt | 1 + .../fieldAsClassDelegate.fir.kt | 2 +- .../suspendFunctionN.fir.kt | 4 --- .../suspendFunctionType/suspendFunctionN.kt | 1 + .../jdkModulesFromNamed/main.fir.txt | 4 +-- .../releaseFlag/moduleSwing.fir.txt | 4 +-- 13 files changed, 71 insertions(+), 47 deletions(-) delete mode 100644 compiler/testData/diagnostics/tests/annotations/unresolvedReferenceRange.fir.kt delete mode 100644 compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/suspendFunctionN.fir.kt diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/annotationClassWithJavaTarget.out_of_src_roots.txt b/analysis/low-level-api-fir/testdata/lazyResolve/annotationClassWithJavaTarget.out_of_src_roots.txt index 039650e8434..882e88e9690 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/annotationClassWithJavaTarget.out_of_src_roots.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/annotationClassWithJavaTarget.out_of_src_roots.txt @@ -45,7 +45,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt TYPES: FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt - @[Types](ElementType#.TYPE_USE#) public? final? [ResolvedTo(TYPES)] annotation class ResolveMe : R|kotlin/Annotation| { + @[Types](ElementType#.TYPE_USE#) public? final? [ResolvedTo(TYPES)] annotation class ResolveMe : R|kotlin/Annotation| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| { LAZY_super } @@ -54,7 +54,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt STATUS: FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt - @[Types](ElementType#.TYPE_USE#) public final [ResolvedTo(STATUS)] annotation class ResolveMe : R|kotlin/Annotation| { + @[Types](ElementType#.TYPE_USE#) public final [ResolvedTo(STATUS)] annotation class ResolveMe : R|kotlin/Annotation| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| { LAZY_super } @@ -63,7 +63,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt - @[Types](ElementType#.TYPE_USE#) public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] annotation class ResolveMe : R|kotlin/Annotation| { + @[Types](ElementType#.TYPE_USE#) public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] annotation class ResolveMe : R|kotlin/Annotation| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| { LAZY_super } @@ -72,7 +72,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt - @[Types](ElementType#.TYPE_USE#) public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] annotation class ResolveMe : R|kotlin/Annotation| { + @[Types](ElementType#.TYPE_USE#) public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] annotation class ResolveMe : R|kotlin/Annotation| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| { LAZY_super } @@ -81,7 +81,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt CONTRACTS: FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt - @[Types](ElementType#.TYPE_USE#) public final [ResolvedTo(CONTRACTS)] annotation class ResolveMe : R|kotlin/Annotation| { + @[Types](ElementType#.TYPE_USE#) public final [ResolvedTo(CONTRACTS)] annotation class ResolveMe : R|kotlin/Annotation| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| { LAZY_super } @@ -90,7 +90,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt IMPLICIT_TYPES_BODY_RESOLVE: FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt - @[Types](ElementType#.TYPE_USE#) public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] annotation class ResolveMe : R|kotlin/Annotation| { + @[Types](ElementType#.TYPE_USE#) public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] annotation class ResolveMe : R|kotlin/Annotation| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| { LAZY_super } @@ -99,7 +99,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt ANNOTATIONS_ARGUMENTS_MAPPING: FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt - @[Types]() public final [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] annotation class ResolveMe : R|kotlin/Annotation| { + @[Types]() public final [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] annotation class ResolveMe : R|kotlin/Annotation| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| { LAZY_super } @@ -108,7 +108,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt BODY_RESOLVE: FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt - @[Types]() public final [ResolvedTo(BODY_RESOLVE)] annotation class ResolveMe : R|kotlin/Annotation| { + @[Types]() public final [ResolvedTo(BODY_RESOLVE)] annotation class ResolveMe : R|kotlin/Annotation| { public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| { super() } @@ -117,7 +117,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt FILE RAW TO BODY: FILE: [ResolvedTo(BODY_RESOLVE)] annotationClassWithJavaTarget.kt - @[Types]() public final [ResolvedTo(BODY_RESOLVE)] annotation class ResolveMe : R|kotlin/Annotation| { + @[Types]() public final [ResolvedTo(BODY_RESOLVE)] annotation class ResolveMe : R|kotlin/Annotation| { public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| { super() } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/annotationParameters.txt b/analysis/low-level-api-fir/testdata/lazyResolve/annotationParameters.txt index 1a91e22457a..0fa8fef07ed 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/annotationParameters.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/annotationParameters.txt @@ -437,12 +437,12 @@ FILE: [ResolvedTo(IMPORTS)] annotationParameters.kt } public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| { - public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=/Anno.args] args: ): R|Anno| { + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=/Anno.args] args: ): R|Anno| { LAZY_super } - public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val args: = R|/args| - public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): + public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val args: = R|/args| + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): } public final [ResolvedTo(STATUS)] class B : R|kotlin/Any| { @@ -476,12 +476,12 @@ FILE: [ResolvedTo(IMPORTS)] annotationParameters.kt } public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| { - public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=/Anno.args] args: ): R|Anno| { + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=/Anno.args] args: ): R|Anno| { LAZY_super } - public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val args: = R|/args| - public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): + public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val args: = R|/args| + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): } public final [ResolvedTo(STATUS)] class B : R|kotlin/Any| { @@ -515,12 +515,12 @@ FILE: [ResolvedTo(BODY_RESOLVE)] annotationParameters.kt } public final [ResolvedTo(BODY_RESOLVE)] annotation class Anno : R|kotlin/Annotation| { - public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Anno] constructor([ResolvedTo(BODY_RESOLVE)] [CorrespondingProperty=/Anno.args] args: ): R|Anno| { + public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Anno] constructor([ResolvedTo(BODY_RESOLVE)] [CorrespondingProperty=/Anno.args] args: ): R|Anno| { super() } - public final [ResolvedTo(BODY_RESOLVE)] [IsFromPrimaryConstructor=true] val args: = R|/args| - public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Anno] get(): + public final [ResolvedTo(BODY_RESOLVE)] [IsFromPrimaryConstructor=true] val args: = R|/args| + public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Anno] get(): } public final [ResolvedTo(BODY_RESOLVE)] class B : R|kotlin/Any| { diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/annotationParametersScript.txt b/analysis/low-level-api-fir/testdata/lazyResolve/annotationParametersScript.txt index df7897e76b9..26830ea60ee 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/annotationParametersScript.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/annotationParametersScript.txt @@ -519,12 +519,12 @@ FILE: [ResolvedTo(IMPORTS)] annotationParametersScript.kts } public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| { - public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=/Anno.args] args: ): R|Anno| { + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=/Anno.args] args: ): R|Anno| { LAZY_super } - public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val args: = R|/args| - public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): + public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val args: = R|/args| + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): } @@ -544,7 +544,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationParametersScript.kts BODY_RESOLVE: FILE: [ResolvedTo(IMPORTS)] annotationParametersScript.kts context(