[LL FIR] rewrite status phase transformer

Now we will try to avoid redundant calculation:
* Class-like declarations can be calculated without super types
* Overridden search logic not is out of lock

Unfortunately, right now it is not safe to use
StatusResolveMode.FunctionWithSpecificName and
StatusResolveMode.PropertyWithSpecificName
because lazyResolveToPhaseWithCallableMembers can lead to an incorrect
state of scope. Example:
```
open class A {
  open fun a() {}
  open fun b() {}
}
class C : A()
```
Steps:
1. Resolve constructor of C to STATUS
2. Now we want to call lazyResolveToPhaseWithCallableMembers on
C, and this call will do nothing because this class and all
its declarations (only constructor) are already in STATUS phase,
so class A won't be resolved as expected

^KT-56551
This commit is contained in:
Dmitrii Gridin
2023-05-15 17:08:21 +02:00
committed by Space Team
parent e464af00db
commit 2885df14ee
25 changed files with 701 additions and 572 deletions
@@ -62,7 +62,7 @@ STATUS:
FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt
[ResolvedTo(BODY_RESOLVE)] annotations container
@R|java/lang/annotation/Target|[Types](ElementType#.TYPE_USE#) public final [ResolvedTo(STATUS)] annotation class ResolveMe : R|kotlin/Annotation| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| {
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| {
LAZY_super<R|kotlin/Any|>
}
@@ -72,7 +72,7 @@ EXPECT_ACTUAL_MATCHING:
FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt
[ResolvedTo(BODY_RESOLVE)] annotations container
@R|java/lang/annotation/Target|[Types](ElementType#.TYPE_USE#) public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] annotation class ResolveMe : R|kotlin/Annotation| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| {
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| {
LAZY_super<R|kotlin/Any|>
}
@@ -82,7 +82,7 @@ ARGUMENTS_OF_ANNOTATIONS:
FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt
[ResolvedTo(BODY_RESOLVE)] annotations container
@R|java/lang/annotation/Target|[Types](Q|java/lang/annotation/ElementType|.TYPE_USE#) public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] annotation class ResolveMe : R|kotlin/Annotation| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| {
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| {
LAZY_super<R|kotlin/Any|>
}
@@ -92,7 +92,7 @@ CONTRACTS:
FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt
[ResolvedTo(BODY_RESOLVE)] annotations container
@R|java/lang/annotation/Target|[Types](Q|java/lang/annotation/ElementType|.TYPE_USE#) public final [ResolvedTo(CONTRACTS)] annotation class ResolveMe : R|kotlin/Annotation| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| {
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| {
LAZY_super<R|kotlin/Any|>
}
@@ -102,7 +102,7 @@ IMPLICIT_TYPES_BODY_RESOLVE:
FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt
[ResolvedTo(BODY_RESOLVE)] annotations container
@R|java/lang/annotation/Target|[Types](Q|java/lang/annotation/ElementType|.TYPE_USE#) public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] annotation class ResolveMe : R|kotlin/Annotation| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| {
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| {
LAZY_super<R|kotlin/Any|>
}
@@ -112,7 +112,7 @@ ANNOTATIONS_ARGUMENTS_MAPPING:
FILE: [ResolvedTo(IMPORTS)] annotationClassWithJavaTarget.kt
[ResolvedTo(BODY_RESOLVE)] annotations container
@R|java/lang/annotation/Target|[Types](value = vararg(Q|java/lang/annotation/ElementType|.<Unresolved name: TYPE_USE>#)) public final [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] annotation class ResolveMe : R|kotlin/Annotation| {
public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| {
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|ResolveMe| {
LAZY_super<R|kotlin/Any|>
}