[LL FIR] support lazy resolve of destructuring declaration entries

^KT-62840 Fixed
^KT-65727
This commit is contained in:
Dmitrii Gridin
2024-02-09 23:42:01 +01:00
committed by Space Team
parent 8c63e75f06
commit e02c28c88a
52 changed files with 7835 additions and 14 deletions
@@ -0,0 +1,7 @@
// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry
data class MyPair(val a: Int, val b: Int)
const val prop = 0
annotation class DestrAnno(val s: String)
val (<expr>@DestrAnno("destr 1 $prop")</expr> a, b) = MyPair(1, 2)
@@ -0,0 +1,50 @@
KT element: KtAnnotationEntry
FIR element: FirAnnotationCallImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
@R|DestrAnno|[Types](s = <strcat>(String(destr 1 ), R|/prop|))
FIR FILE:
FILE: [ResolvedTo(IMPORTS)] destructuringEntryAnnotation.kts
context(<script>@R|kotlin/script/templates/standard/ScriptTemplateWithArgs|)
SCRIPT: [ResolvedTo(TYPES)] <script-destructuringEntryAnnotation.kts>
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
public final data [ResolvedTo(CONTRACTS)] class MyPair : R|kotlin/Any| {
public [ResolvedTo(CONTRACTS)] [ContainingClassKey=MyPair] constructor([ResolvedTo(CONTRACTS)] [CorrespondingProperty=/MyPair.a] a: R|kotlin/Int|, [ResolvedTo(CONTRACTS)] [CorrespondingProperty=/MyPair.b] b: R|kotlin/Int|): R|MyPair| {
LAZY_super<R|kotlin/Any|>
}
public final [ResolvedTo(CONTRACTS)] [ComponentFunctionSymbolKey=/MyPair.component1, IsFromPrimaryConstructor=true] val a: R|kotlin/Int| = R|<local>/a|
public [ResolvedTo(CONTRACTS)] [ContainingClassKey=MyPair] get(): R|kotlin/Int|
public final [ResolvedTo(STATUS)] [ComponentFunctionSymbolKey=/MyPair.component2, IsFromPrimaryConstructor=true] val b: R|kotlin/Int| = R|<local>/b|
public [ResolvedTo(STATUS)] [ContainingClassKey=MyPair] get(): R|kotlin/Int|
public final operator [ResolvedTo(CONTRACTS)] fun component1(): R|kotlin/Int|
public final operator [ResolvedTo(STATUS)] fun component2(): R|kotlin/Int|
public final [ResolvedTo(STATUS)] fun copy([ResolvedTo(STATUS)] a: R|kotlin/Int| = this@R|/MyPair|.R|/MyPair.a|, [ResolvedTo(STATUS)] b: R|kotlin/Int| = this@R|/MyPair|.R|/MyPair.b|): R|MyPair|
}
public final const [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val prop: R|kotlin/Int| = Int(0)
public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/Int|
public final [ResolvedTo(STATUS)] annotation class DestrAnno : R|kotlin/Annotation| {
public [ResolvedTo(STATUS)] [ContainingClassKey=DestrAnno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=/DestrAnno.s] s: R|kotlin/String|): R|DestrAnno| {
LAZY_super<R|kotlin/Any|>
}
public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val s: R|kotlin/String| = R|<local>/s|
public [ResolvedTo(STATUS)] [ContainingClassKey=DestrAnno] get(): R|kotlin/String|
}
[ResolvedTo(ANNOTATION_ARGUMENTS)] [DestructuringDeclarationContainerVariableMarkerKey=true] lval <destruct>: R|MyPair| = R|/MyPair.MyPair|(Int(1), Int(2))
@R|DestrAnno|[Types](s = <strcat>(String(destr 1 ), R|/prop|)) public final [ResolvedTo(ANNOTATION_ARGUMENTS)] [DestructuringDeclarationContainerVariableKey=<local>/<destruct>] val a: R|kotlin/Int| = R|<local>/<destruct>|.R|/MyPair.component1|()
public final [ResolvedTo(RAW_FIR)] [DestructuringDeclarationContainerVariableKey=<local>/<destruct>] val b: <implicit> = LAZY_EXPRESSION
@@ -3,7 +3,7 @@ FIR element: FirPropertyImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
[ResolvedTo(BODY_RESOLVE)] [DestructuringDeclarationContainerVariableMarkerKey=true] lval <destruct>: <ERROR TYPE REF: Initializer required for destructuring declaration> = ERROR_EXPR(Initializer required for destructuring declaration)
public final [ResolvedTo(BODY_RESOLVE)] [DestructuringDeclarationContainerVariableKey=<local>/<destruct>] val o: <ERROR TYPE REF: Unresolved name: component1> = R|<local>/<destruct>|.<Unresolved name: component1>#()
FIR FILE:
FILE: [ResolvedTo(IMPORTS)] destructionWithNoRValueScript.kts
@@ -11,8 +11,8 @@ FILE: [ResolvedTo(IMPORTS)] destructionWithNoRValueScript.kts
SCRIPT: [ResolvedTo(TYPES)] <script-destructionWithNoRValueScript.kts>
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
[ResolvedTo(BODY_RESOLVE)] [DestructuringDeclarationContainerVariableMarkerKey=true] lval <destruct>: <ERROR TYPE REF: Initializer required for destructuring declaration> = ERROR_EXPR(Initializer required for destructuring declaration)
public final [ResolvedTo(RAW_FIR)] [DestructuringDeclarationContainerVariableKey=<local>/<destruct>] val o: <implicit> = LAZY_EXPRESSION
[ResolvedTo(ANNOTATION_ARGUMENTS)] [DestructuringDeclarationContainerVariableMarkerKey=true] lval <destruct>: <ERROR TYPE REF: Initializer required for destructuring declaration> = ERROR_EXPR(Initializer required for destructuring declaration)
public final [ResolvedTo(BODY_RESOLVE)] [DestructuringDeclarationContainerVariableKey=<local>/<destruct>] val o: <ERROR TYPE REF: Unresolved name: component1> = R|<local>/<destruct>|.<Unresolved name: component1>#()
public final [ResolvedTo(RAW_FIR)] [DestructuringDeclarationContainerVariableKey=<local>/<destruct>] val r: <implicit> = LAZY_EXPRESSION
public final [ResolvedTo(RAW_FIR)] [DestructuringDeclarationContainerVariableKey=<local>/<destruct>] val r: <implicit> = LAZY_EXPRESSION
@@ -3,7 +3,7 @@ FIR element: FirPropertyImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
[ResolvedTo(BODY_RESOLVE)] [DestructuringDeclarationContainerVariableMarkerKey=true] lval <destruct>: R|kotlin/Pair<kotlin/Int, kotlin/Int>| = Int(1).R|kotlin/to|<R|kotlin/Int|, R|kotlin/Int|>(Int(2))
public final [ResolvedTo(BODY_RESOLVE)] [DestructuringDeclarationContainerVariableKey=<local>/<destruct>] val a: R|kotlin/Int| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component1: R|kotlin/Int|>|()
FIR FILE:
FILE: [ResolvedTo(IMPORTS)] destructuringEntryScript.kts
@@ -11,8 +11,8 @@ FILE: [ResolvedTo(IMPORTS)] destructuringEntryScript.kts
SCRIPT: [ResolvedTo(TYPES)] <script-destructuringEntryScript.kts>
[ResolvedTo(RAW_FIR)] lval args: R|kotlin/Array<kotlin/String>|
[ResolvedTo(BODY_RESOLVE)] [DestructuringDeclarationContainerVariableMarkerKey=true] lval <destruct>: R|kotlin/Pair<kotlin/Int, kotlin/Int>| = Int(1).R|kotlin/to|<R|kotlin/Int|, R|kotlin/Int|>(Int(2))
public final [ResolvedTo(RAW_FIR)] [DestructuringDeclarationContainerVariableKey=<local>/<destruct>] val a: <implicit> = LAZY_EXPRESSION
[ResolvedTo(ANNOTATION_ARGUMENTS)] [DestructuringDeclarationContainerVariableMarkerKey=true] lval <destruct>: R|kotlin/Pair<kotlin/Int, kotlin/Int>| = Int(1).R|kotlin/to|<R|kotlin/Int|, R|kotlin/Int|>(Int(2))
public final [ResolvedTo(BODY_RESOLVE)] [DestructuringDeclarationContainerVariableKey=<local>/<destruct>] val a: R|kotlin/Int| = R|<local>/<destruct>|.R|SubstitutionOverride<kotlin/Pair.component1: R|kotlin/Int|>|()
public final [ResolvedTo(RAW_FIR)] [DestructuringDeclarationContainerVariableKey=<local>/<destruct>] val b: <implicit> = LAZY_EXPRESSION