Commit Graph

119 Commits

Author SHA1 Message Date
Mikhail Glukhikh 8c305d6143 K2: introduce infrastructure for LanguageVersionSettings checkers 2023-07-24 12:50:38 +00:00
Kirill Rakhman 9288a96f6d [FIR] Assert source is not-null when reporting cone diagnostics
#KT-55835
#KT-59856
2023-07-20 07:29:18 +00:00
Marco Pennekamp 4ead02271b [FIR] Move TrackableModuleInfo to the common frontend
- FIR-specific parts of the Kotlin IntelliJ plugin depend on
  `TrackableModuleInfo`, so it should be part of the common frontend.
2023-07-19 13:03:51 +00:00
Ilya Kirillov a9cd881a07 [FIR] add utilities to FIR compiler to throw error with attachment 2023-07-18 11:49:20 +00:00
Ilya Kirillov 15f6fe2627 Move ExceptionAttachmentBuilder near KotlinExceptionWithAttachments so it's accessible from KotlinExceptionWithAttachments 2023-07-18 11:49:20 +00:00
Anna Kozlova 190d49a1e0 [light classes] optimize accessors retrieval
Avoid expensive calls to `navigationElement` for methods
that cannot be getters/setters and would be filtered later.
Repeat partly naming generation strategy.

Merge-request: KT-MR-10689
Merged-by: Anna Kozlova <Anna.Kozlova@jetbrains.com>
2023-06-22 14:14:39 +00:00
Alexander Udalov da884bd554 Minor, add error message to linker exception
(cherry picked from commit 04048d57ab912823504e9f57ddbc3a5f06b6af7c)
2023-06-21 14:24:28 +00:00
Kirill Rakhman 8ff67218f5 [FIR] Fix serialization of annotation vararg arguments
#KT-58937 Fixed
2023-06-14 08:41:27 +00:00
Dmitriy Novozhilov ba41e8ec38 [IR] Use common expect/actual matching algorithm in IR actualizer
^KT-58578 Fixed
2023-06-10 07:33:29 +00:00
Andrei Klunnyi 2a1d4a42ae [KT-58817] Implicit import issues cannot be reported
To be reported with [1] imports require source. It was missing for
implicit script imports.

`FirScriptConfiguratorExtensionImpl` was extended and now adds fake
source elements (users don't see imports in the source code).

Since diagnostics for implicit import statements are meaningless for
IDE, they are suppressed in `LLFirDiagnosticReporter`.

----------------------------------------------------------------------
[1]: DiagnosticReporter.reportOn()
2023-05-26 12:55:00 +00:00
Kirill Rakhman bdf0b41026 [FIR] Consolidate SYNTAX and SYNTAX_WITH_MESSAGE diagnostics 2023-05-05 09:34:23 +00:00
Nikolay Lunyak efbcfb4994 [FIR] Prevent duplicate FileAnalysisException-s 2023-05-03 10:04:25 +00:00
Kirill Rakhman a818c543a9 [FIR] Verify diagnostic messages don't reference non-existent parameters 2023-04-27 12:54:31 +00:00
Yahor Berdnikau eb4e96a113 Add kotlin-build-tools-enum-compat workaround
It acts as a workaround for the case when build tools or dependencies
are compiled with latest 'kotlin-stdlib' version, but at a runtime older
 'kotlin-stdlib' is provided, which does not know about new
 `EnumEntries`.

 ^KT-57317 Fixed
2023-04-21 14:57:17 +00:00
Nikolay Lunyak f644eb7988 [FIR JS] Implement FirJsExportDeclarationChecker 2023-03-29 08:51:48 +03:00
Nikolay Lunyak a2e2a96fd3 [FIR] KT-56846: Unwrap SourceCodeAnalysisException on transformFile
^KT-56846 Fixed

Merge-request: KT-MR-9065
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-03-23 09:54:43 +00:00
Ivan Kylchik 2302e14dd6 [FIR LT] Extract getChildren function into common utils 2023-03-21 16:33:01 +00:00
Kirill Rakhman 45d2424ad8 [FIR] Let prefix inc/dec call getter twice for compatibility with K1
#KT-57179 Fixed
2023-03-21 08:48:38 +00:00
Denis.Zharkov 3f052af517 K2: Propagate explicit getter type to the property without initializer
In K1, we have the rules like:
- if there's explicit type of a property, then use it
- if there's an initializer, obtain its expression-type
- Otherwise, use getter's return type

The case when getter's type is implicit is handled at
FirDeclarationsResolveTransformer.transformProperty

^KT-56707 Fixed
2023-02-21 18:39:40 +00:00
Yahor Berdnikau 0cad069522 [Build] Pin api and language level to 1.8 in Kotlin compiler modules used by KGP
This is required to be able to compile KGP and it's dependencies which
set LV to 1.4 when repo will use LV 1.9. This caused by the change how
enums are compiled (KT-48872).
2023-02-18 13:26:54 +00:00
Denis.Zharkov 8fa84e7bea K2: Add clarification comment to KtFakeSourceElementKind 2023-02-15 08:13:55 +00:00
Denis.Zharkov d7399ed1cf K2: Avoid losing diagnostics for synthetic calls
Some of the changed tests may duplicate other existing diagnostics,
but that should not be reason not to report them at all.

There might be another job to be done to avoid diagnostic duplications
2023-02-15 08:13:41 +00:00
Denis.Zharkov a311d6eea0 K2: Extract CheckerContextForProvider from CheckerContext
So, the idea is that CheckerContext should remain just read-only
while the one who runs the checkers might build/modify the context.

^KT-56460 Related
2023-02-09 12:08:05 +00:00
Dmitriy Novozhilov f479a56f5e [FIR] Fix reporting of CANNOT_INFER_PARAMETER_TYPE on lambda parameters
^KT-56138 Fixed
2023-02-06 08:09:57 +00:00
Dmitriy Novozhilov ad3ae0ff69 [FIR] Add ability to specify that diagnostic collector should visit nodes with specific fake kind 2023-02-06 08:09:55 +00:00
Kirill Rakhman ace47c06a5 FIR: Make LHS of FirVariableAssignment a FirExpression
This way references can even be resolved for erroneous assignments
(e.g. function call, if expression, ... on LHS)

^KT-54648 Fixed
2023-01-31 08:39:42 +00:00
Ilya Chernikov 37a7044e74 FIR LT: fix line offsets calculations for text files with crlf
#KT-55886 fixed
2023-01-30 08:47:40 +00:00
Mikhail Glukhikh 4167a69e30 K2: generate implicit dispatch receivers for static members called
#KT-55371 Fixed
#KT-55372 Fixed
2023-01-26 15:27:57 +00:00
Kirill Rakhman a7edf5b83e FIR: Throw if source is null in DiagnosticReporter.reportOn ^KT-55284 Fixed 2023-01-11 08:30:36 +00:00
Ilya Kirillov 79fe4100aa [FIR] extract exception handing into a service to have additional implementation for the ide 2023-01-03 10:23:50 +00:00
Alexander Udalov 3c4b5529af Update year to 2023 in COPYRIGHT_HEADER.txt
This commit is the result of changing the year to 2023 in
COPYRIGHT_HEADER.txt and running all `generate*` tasks in
`generators/build.gradle.kts`.
2023-01-02 22:52:15 +01:00
Yan Zhulanow d652dc620c [FE] Preserve legacy contract description calls in bodies
^KT-55231 Fixed
^KTIJ-21012 Fixed
2022-12-26 11:46:58 +00:00
Anna Kozlova 15b1e429d7 [compiler] introduce dedicated Fir declaration for dangling modifier lists (KTIJ-23008)
ensure fir annotations are included in FirDanglingModifierList and resolved,
dedicated DanglingTopLevelModifierListStructureElement exists for top
level lists only, class level lists are processed by containing structure
element
2022-12-21 20:58:46 +00:00
Mikhail Glukhikh af96c735bb K2: use PUBLICATION mode for lazy members in KtSourceElement
This commit removes performance problems during these members access
2022-12-17 21:44:58 +00:00
Ilya Kirillov 7a89ca495c [LL FIR] do not execute resolve under a non-cancellable session
The sessions are invalidated on the PCE
2022-12-06 21:20:41 +00:00
Nikolay Lunyak 2e9f9f987b [FIR] KT-44698: Print file:line:offset on K2 crash
^KT-44698 Fixed
2022-11-29 22:35:51 +00:00
Dmitrii Gridin 22cfea5058 [FIR] introduce KtFakeSourceElementKind.ReceiverFromType
^KT-54417
2022-11-17 09:50:13 +00:00
Anna Kozlova 3590c4ea35 [Analysis API FIR] support generated temp properties
KTIJ-23492 (array index expression), KTIJ-23138 (inc/dec desugaring)
2022-11-11 17:39:53 +01:00
Mikhail Glukhikh d00af1c932 FE: drop DiagnosticReporter.context.report & rename reportAndCommit 2022-10-17 12:46:24 +00:00
Mikhail Glukhikh 1826d9b332 K2: add & fix tests for JVM BE diagnostics 2022-10-17 12:46:24 +00:00
Xin Wang 69a4de0461 K2 JVM: Take JVM declarations conflicting error back
Since SimpleDiagnosticsCollectorWithSuppress have been replaced by
PendingDiagnosticsCollectorWithSuppress after commit 9add6f3d55,
diagnostics need to be committed now.

#KT-54366 Fixed
2022-10-17 12:46:23 +00:00
Dmitriy Novozhilov c0ad67c4f9 [FIR] Generate java declarations for record components of java records
^KT-53964 Fixed
2022-10-03 15:48:17 +03:00
Dmitriy Novozhilov 6ef3d1e573 [FE] Add helper methods for reporting diagnostics with DiagnosticContext context receiver 2022-09-07 07:57:36 +00:00
Simon Ogorodnik 513af2dfbc FIR. Refactor smart-cast representation in FIR tree
Make smart-casts non-transparent expression without delegation
to underlying FirQualifiedAccessExpression, as children delegation in
fir tree has unclear semantics
Remove two different kinds of tree nodes for smart-casts
2022-08-15 21:46:11 +00:00
Dmitry Gridin 4ceb170917 regenerate tests 2022-08-05 14:12:41 +02:00
Mikhail Glukhikh bc396b9765 K2: don't report RETURN_TYPE_MISMATCH on last statement returns
#KT-53198 Fixed
2022-07-22 16:39:51 +00:00
Mikhail Glukhikh 07f16ef378 K2 LL API: implement automatic diagnostic suppression 2022-07-22 11:35:27 +00:00
Mikhail Glukhikh 9add6f3d55 K2: add more accurate & more automatic control of diagnostic suppression
#KT-51363 Fixed
2022-07-22 11:35:26 +00:00
Dmitriy Novozhilov f587c02d38 [FE] Move ServiceLoaderLite to :compiler:frontend.common
This is needed to be able to use this class inside FIR part of IDE plugin
2022-06-29 12:00:00 +00:00
Ivan Kochurkin b573532d8c Introduce COMPONENT_FUNCTION_NAME_PREFIX constant 2022-06-17 23:26:15 +00:00