Commit Graph

106427 Commits

Author SHA1 Message Date
Dmitrii Gridin 38c959ba5a [LL FIR] resolve original declarations before fake
This is required to have stable resolution order to avoid concurrent
modifications and correct resolution context.
E.g., this commit fixes the resolution behavior of fake override for
ANNOTATION_ARGUMENTS phase – now annotation argument resolves correctly.

We shouldn't do additional checks in the case of fake declaration
because they should be done on the original side

^KT-63042
2023-11-23 15:55:07 +00:00
Dmitrii Gridin ab26a02d19 [LL FIR] resolve generated property before copy
This is required to have stable resolution order to avoid concurrent
modifications

^KT-63042
2023-11-23 15:55:07 +00:00
Dmitrii Gridin c31d860f10 [FIR] LightTreeRawFirBuilder: add copyWithNewSourceKind for generated copy
This is done for consistency

^KT-63042
2023-11-23 15:55:07 +00:00
Dmitrii Gridin 9d72c1c370 [FIR] builder: drop unused forcedElementSourceKind
There was only one usage by withDefaultSourceElementKind that was
dropped in the previous commit

^KT-63042
2023-11-23 15:55:07 +00:00
Dmitrii Gridin 6c1f5b7a74 [FIR] PsiRawFirBuilder: reuse type for copy from generated property
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:07 +00:00
Dmitrii Gridin a79cef08b5 [LL FIR] resolve generated property before componentN
This is required to have stable resolution order to avoid concurrent
modifications.
Another point here – status phase logic for componentN function is
located in the corresponding property resolution

^KT-63042
2023-11-23 15:55:07 +00:00
Dmitrii Gridin 5fa516e010 [LL FIR] resolve constructor parameter before generated property
This is required to have stable resolution order to avoid concurrent
modifications

^KT-63042
2023-11-23 15:55:06 +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 8dacd41818 [LL FIR] introduce lazy resolve tests for type annotations
From one side to check how annotation propagation works and from another
side to cover scenarios with lazy resolution from type position as it is
a valid case of usage in Analysis API (KtFirAnnotationListForType)

^KT-63042
2023-11-23 15:55:06 +00:00
Dmitrii Gridin 689fe28efa [FIR] FirScriptSymbol: add stable toString
It will be used in tests

^KT-63042
2023-11-23 15:55:06 +00:00
Svyatoslav Kuzmich b3bc99a44a [Build] Use impl dependencies for compiler.common.{web,wasm}
Refactor build scripts to use implementation dependencies instead of api
for finer grained recompilations.
2023-11-23 15:52:55 +00:00
Ivan Kochurkin a04deba7c7 [FIR] Fix compiler crash with incorrect argument in FirDanglingModifierList
KT-63508 Fixed
2023-11-23 15:25:44 +00:00
Tatiana Bogdanova fc5239bdfd Add changelog for 1.9.21 2023-11-23 14:36:56 +00:00
Kirill Rakhman 11ab90ecbd [Tests] Add regression test for #KT-63732 2023-11-23 14:24:47 +00:00
Kirill Rakhman 9ea4afe7c8 [FIR] Fix isValidTypeParameterFromOuterDeclaration check for local class
This fixes an IllegalArgumentException when
symbolProvider.getClassLikeSymbolByClassId is called with a local
class ID.

#KT-63656 Fixed
2023-11-23 14:24:47 +00:00
Marco Pennekamp a703f5afb8 [LL] Use emptyMap() for empty FileStructureElementDiagnosticLists
- This improves the memory usage of `FileStructureElementDiagnosticList`
  by avoiding lots of duplicate empty mutable maps. We can assume that
  most diagnostics lists are empty, since code is usually green.
- I tested the memory consumption manually by opening all files in
  `org.jetbrains.kotlin.idea.k2.codeinsight.inspections` and waiting for
  analysis to finish for each file. With the change, the retained size
  of `FileStructureElementDiagnosticList` shrank from 63.39kB to
  13.77kB.
2023-11-23 14:00:43 +00:00
Sebastian Sellmair 59c4c83ed5 [K/N] Samples: Update samples default Kotlin version to 1.9.20 2023-11-23 13:19:04 +00:00
Sebastian Sellmair 359f5fe7b3 [K/N] Samples: Migrate 'echoServer' to modern multiplatform
^KT-50547 Fixed
2023-11-23 13:19:04 +00:00
Anastasia.Nekrasova 97ef2de6e3 [K2] OPT_IN_USAGE_ERROR is absent when calling the enum primary constructor
^KT-63459
2023-11-23 13:16:05 +00:00
Anastasia.Nekrasova c6d391c632 [K2] OPT_IN_MARKER_CAN_ONLY_BE_USED_AS_ANNOTATION_OR_ARGUMENT_IN_OPT_IN on an annotation import
Only tests added

^KT-59582
2023-11-23 13:14:42 +00:00
Roman Efremov fa20eb73f2 [Tests] Don't ignore expected file if diagnostic output is empty
Because of this, `checkDiagnosticFullText.fir.diag.txt` was
obsolete, because nothing was reported, but test was green.

^KT-62559
2023-11-23 12:17:34 +00:00
Roman Efremov fcc6f873c7 [FIR] Prevent reporting ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT twice in CLI
It is duplicated because we have two checkers: FIR (for IDE support
in simple cases) and IR ("honest" checker supporting all cases).
Fix this by running FIR checker only in IDE.

FIR checker behavior remains covered by tests in
`LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated`.

^KT-62559 Fixed
2023-11-23 12:17:34 +00:00
Roman Efremov a466b14264 [FIR] Refactor: extract ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT checker
...into separate object.

^KT-62559
2023-11-23 12:17:34 +00:00
Svyatoslav Kuzmich 3e88fc80d2 [AA] Regenerate AA after moving diagnostics from js to web.common 2023-11-23 10:42:57 +00:00
Svyatoslav Kuzmich cf3b293072 [Wasm] Move external RTT checkers to web.common and reuse in Wasm
#KT-56849
2023-11-23 10:42:56 +00:00
Svyatoslav Kuzmich d219d5380b [Wasm] Move FirJsQualifierChecker to web.common and reuse in Wasm
#KT-56849
2023-11-23 10:42:56 +00:00
Svyatoslav Kuzmich 640bf67480 [Wasm] Move FirJsExportAnnotationChecker to web.common and reuse in Wasm
#KT-56849
2023-11-23 10:42:56 +00:00
Svyatoslav Kuzmich c1fa0a3e8c [Web] Move common ids from WasmStandardClassIds to WebCommonStandardClassIds 2023-11-23 10:42:56 +00:00
Svyatoslav Kuzmich 910835af2d [Web] Add core/compiler.common.web module
Add WebCommonStandardClassIds object to use in JS&Wasm shared code
2023-11-23 10:42:56 +00:00
Stanislav Ruban ec995fc847 [tests] Regenerate configurations for box-tests 2023-11-23 09:34:15 +00:00
Stanislav Ruban 9956c0f83b [tests] Cover KT-63654 with test cases 2023-11-23 09:34:14 +00:00
Anastasia.Nekrasova 6471080c48 [K2] Disappeared UNSUPPORTED
Mark as UNSUPPORTED suspension points in default parameters

^KT-59881
2023-11-23 09:29:07 +00:00
Brian Norman c1f6fe1e76 [FIR] Do not include transitive friend dependencies in symbol provider
When flattening a dependency FirSymbolProvider, make sure transitive
dependency FirSymbolProviders are not included. This requires checking
that nested symbol provider sessions match the composite symbol provider
session when they are both source sessions.

^KT-60614 Fixed
2023-11-22 19:43:24 +00:00
Artem Kobzar 33ab1871c7 [K/JS] Fix coroutines but turn back the fix for coroutines intrinsics intercepted and releaseIntercepted 2023-11-22 18:10:08 +00:00
Ilya Gorbunov d8ee74222f [builtins-gen] Explicit visibility for companion objects and secondary constructors 2023-11-22 18:04:34 +00:00
Ilya Gorbunov ab7c2f2196 [stdlib] Explicit visibility and return types: builtins 2023-11-22 18:04:34 +00:00
Ilya Gorbunov df190b1265 [stdlib] Explicit visibility and return types: JVM internal 2023-11-22 18:04:34 +00:00
Ilya Gorbunov 2e030f213b [stdlib] Explicit visibility and return types: JVM 2023-11-22 18:04:34 +00:00
Ilya Gorbunov c77930c1ea [stdlib] Explicit visibility and return types: Native 2023-11-22 17:57:40 +00:00
Egor Kulikov 43fc4ccf40 [FIR] Source for implicit iterator calls in for should not be null
^KT-62111 fixed


Merge-request: KT-MR-13029
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-11-22 17:15:24 +00:00
Roman Efremov 6a90926e2e [K2] Support reporting of IMPLEMENTATION_BY_DELEGATION_IN_EXPECT_CLASS
^KT-59983
2023-11-22 16:40:06 +00:00
Alexander Korepanov bf54fda8ec [JS Test] Add a test case
Add a test case for a suspend lambda
with a user-defined value class.

^KT-62077 Fixed
2023-11-22 16:29:54 +00:00
Roman Golyshev 347d51c90e KTIJ-27879 [AA] Enforce lazy resolve of code fragments in ContextCollector
Without it, the lazy body of code fragment is not properly resolved
and cannot be analyzed

Use the correct function from `BodyResolveContext` to take the scopes
from code fragment into account

^KTIJ-27879 Fixed
2023-11-22 16:29:28 +00:00
Sergej Jaskiewicz 8eefb210f9 [FIR/IR generator] Introduce the shared Model class 2023-11-22 15:10:16 +00:00
Sergej Jaskiewicz 9a11208e67 [FIR/IR generator] Extract visitFunctionName to AbstractElement 2023-11-22 15:10:16 +00:00
Sergej Jaskiewicz 8ba42a7ff2 [IR generator] Use Element#typeName i/o Element#name where needed
This slightly reduces repetition.
2023-11-22 15:10:16 +00:00
Sergej Jaskiewicz 6ac4cd5973 [IR generator] Get rid of the config model
In the IR generator, we had a so-called `ConfigModel` with classes like
`ElementConfig` and `FieldConfig` that we deal with during
tree configuration in `IrTree.kt`, and another kind of model called
just `Model` that included the `Element` and `Field` classes
correspondingly. Those were used for actual code generation.
After configuration, `ConfigModel` was transformed to `Model` and
then the code generation was performed using `Model`.

This architecture is overly complicated and results in massive code
duplication. Most `ElementConfig` and `FieldConfig` properties had
exactly the same counterparts in `Element` in `Field` classes.

So, if you wanted to add a new feature to the tree generator, you had to
add a property to both `ConfigModel` and `Model`.

Turns out we can do just fine with only one kind of model.
2023-11-22 15:10:16 +00:00
Ilmir Usmanov 37417f7919 KAPT: Use reflection to access code, changed in JDK 21
#KT-57389 Fixed
2023-11-22 14:58:55 +00:00
Ilmir Usmanov 4f7c96ae43 KAPT: Always print parens on empty annotation parameters
Since JDK 17+ pretty-printer does not print parens on empty annotation
parameters, print them anyway. Otherwise, tests with annotations differ
on different JDKs.
 #KT-57389
2023-11-22 14:58:55 +00:00
Ilmir Usmanov 87aed4bf47 KAPT: Run tests on JDK 21
Previously, some tests have also been disabled on JDK 11+, since
we did not filter out empty filesets, which led to failed assertion
inside JDK.
 #KT-57389
2023-11-22 14:58:55 +00:00