25 Commits

Author SHA1 Message Date
Dmitrii Gridin d5cfea330b [LL FIR] support parameters resolution
Script parameters now can be resolved independently of the script.
But, as parameters are part of the script, their resolve will be called
before the script.

^KT-66276 Fixed
2024-03-07 12:50:59 +00:00
Dmitrii Gridin 16878ca20d [LL FIR] FirElementBuilder: support KtAnnotation in file annotations
^KT-65780
2024-03-01 19:19:00 +00:00
Dmitrii Gridin ba92fc97f9 [LL FIR] add test on annotation with [] syntax
^KT-65780
2024-03-01 19:19:00 +00:00
Dmitrii Gridin 17c128adf2 [FIR] get rid of FirFileAnnotationsContainer
This element has been introduced to simplify resolution logic in LL FIR,
but now this element is redundant and only complicates the code as after
KT-56683 `FirFile` has real phases

^KT-65876 Fixed
2024-03-01 19:19:00 +00:00
Dmitrii Gridin 38a3010ac8 [LL FIR] FirElementBuilder: search file annotations without body resolution
^KT-65780
2024-02-14 17:53:31 +00:00
Dmitrii Gridin 7796ef43db [LL FIR] FileStructure: resolve FirFile to body phase as all other elements
This is the correct behavior as we have to resolve to body phase
to build CFG and run diagnostics collector correctly

^KT-65780 Fixed
2024-02-14 17:53:31 +00:00
Dmitrii Gridin e02c28c88a [LL FIR] support lazy resolve of destructuring declaration entries
^KT-62840 Fixed
^KT-65727
2024-02-14 16:16:01 +00:00
Dmitrii Gridin 312feb3dca [FIR] make script destructuring declaration entry initializer lazy expression
This change is required to properly support such declarations in lazy
resolution mode as we usually replaced initializers with lazy
expressions during the body calculation phase

^KT-62840
2024-02-14 16:16:01 +00:00
Dmitrii Gridin 256d83b005 [LL FIR] support lazy resolve of <destruct> script declaration
But support for entries still is not implemented yet

^KT-62840
2024-02-14 16:16:01 +00:00
Dmitrii Gridin 792af849df [LL FIR] add getOrBuildFir test on destructuring declaration annotation
It doesn't resolve the property as it is treated as a local one

^KT-62840
2024-02-14 16:16:01 +00:00
Dmitrii Gridin 4f0bc86ad4 [LL FIR] make result$$ property independent
Now we can resolve this generated property in the same way
as other regular properties.
This is the pre-step for independent script initializers

^KT-65344
^KT-65523
2024-02-13 14:58:31 +00:00
Simon Ogorodnik 53e89a9722 K2. Minor. Rename FirConstExpression to FirLiteralExpression
FirConstExpression is usually confused with "constant" calculations,
while in fact, it just denotes a simple literal expression
and `1 + 1` isn't represented by a FirConstExpression.

^KT-64314 Fixed
2024-01-25 23:05:15 +00:00
Ivan Kochurkin 69b9bfc3e0 [FIR] Initialize public visibility for class-like declarations at FIR building phase if no modifier is presented
Java resolving subsystem requires calculated visibility for correct disambiguation of supertypes.
But visibility remains `Unknown` for Kotlin class-like declarations during supertypes resolving because `STATUS` resolve phase is performed after `SUPER_TYPES` phase.
To fix the problem, the visibility should be initialized to public at the FIR building phase if no modifier is presented.

^KT-64127 Fixed
2024-01-04 16:17:32 +00:00
Dmitrii Gridin 5183019cb8 [LL FIR] resolve class before constructor
This is required to have stable resolution order to avoid concurrent
modifications and correct resolution context.
This also fixes KT-63700 as a super call expands only during body
resolution in the case of secondary constructor

^KT-63042
^KT-63700 Fixed
2023-11-23 15:55:07 +00:00
Dmitrii Gridin 6ecaccbcfe [FIR] PsiRawFirBuilder: reuse type for property from constructor parameter
Previously, this call was required to avoid sharing to have independent
instances with their own resolution cycle. Now we will have stable
order (in the next commit), so it is possible to share instances.
Also, this change makes the logic consistency with Light Tree

^KT-63042
2023-11-23 15:55:06 +00:00
Dmitrii Gridin ba7c341338 [LL FIR] annotation calculator for scripts should process only script inself
We shouldn't calculate annotations inside unrelated declarations without lock

^KT-63042
^KT-63282
2023-11-08 23:22:19 +00:00
Dmitrii Gridin 500de9f9bb [LL FIR] FirElementBuilder: avoid body resolution for type references inside 'where'
^KT-62691 Fixed
2023-10-19 16:24:32 +00:00
Dmitrii Gridin 35567d453b [LL FIR] add lazy resolution tests on 'where' construction
^KT-62691
2023-10-19 16:24:32 +00:00
Dmitrii Gridin 3817f37011 [FIR] rename ANNOTATIONS_ARGUMENTS_MAPPING phase to ANNOTATION_ARGUMENTS
^KT-62679
2023-10-19 14:34:35 +00:00
Dmitrii Gridin 90102ad8b7 [LL FIR] avoid body resolve during getOrBuildFir for super types
This also covers a case with annotations on a super type entry

^KT-61789 Fixed
2023-10-13 17:13:14 +00:00
Dmitrii Gridin 1a01dd4dd4 [Analysis API] add diagnostic tests for unresolved reference inside primary constructor
^KT-62437
2023-10-13 17:13:14 +00:00
Dmitrii Gridin 850201a65c [LL FIR] LLFirContractsLazyResolver: avoid transformation for primary constructors
Primary constructors can't have any contracts.
This change also should improve memory consumption because we will
less frequently calculate bodies.

^KT-55750
2023-09-21 20:08:32 +00:00
Dmitrii Gridin 12dc6b1ebc [FIR] FirRenderer: render name for scripts
A script name is important information, so it is better to render it.
This also will fix the inconsistency with redundant space after 'SCRIPT:'.
2023-09-19 14:03:29 +00:00
Dmitrii Gridin c6bb9af823 [FIR] FirRenderer: add missing resolvePhaseRenderer usage for anonymous initializer and dangling modifiers 2023-09-19 14:03:29 +00:00
Dmitrii Gridin 33e6a85a2d [LL FIR] rename testdata to testData to avoid copyright generation
We exclude testData pattern from copyright scope
2023-09-18 21:12:45 +00:00