Commit Graph

507 Commits

Author SHA1 Message Date
Ilya Kirillov 24db4e62f5 Migrate some FIR/Analysis API KotlinExceptionWithAttachment usages to buildErrorWithAttachment API 2023-07-18 11:49:21 +00:00
Ilya Kirillov 52c065b08a Extract a base class from KotlinExceptionWithAttachments 2023-07-18 11:49:20 +00:00
Yan Zhulanow 6156609617 [PSI] Increment modification stamp on adding imports to 'KtCodeFragment'
LL API incremental analysis depends on modification stamps for files and
declarations. Adding an import directive would modify a modification
stamp of an ordinary KtFile. The same should apply to a KtCodeFragment.
2023-07-05 16:55:38 +00:00
Yan Zhulanow df28bd1d79 [Stubs] Pass proper container source to stub-based FIR declarations
Backend, which is used by the expression evaluator, relies on the class
name in 'FacadeClassSource'. To pass the correct JVM class name,
stubs for top-level functions and properties got the 'origin'.
2023-07-04 11:17:39 +00:00
Egor Kulikov 19fb6e7458 [FIR] Don't resolve parameters in function types in invalid code
^KTIJ-25653 fixed

Merge-request: KT-MR-10831
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-07-03 16:30:14 +00:00
Anna Kozlova 11c4fcda5f [psi][AA] don't decompile code when stubs have enough information
^ KTIJ-25979
+ do not assert when there are no stubs (text is already computed)
2023-06-29 10:09:20 +00:00
Anna Kozlova cc76bbd09d [psi] don't decompile to detect invalid code
in compiled code no error elements are possible

Merge-request: KT-MR-10407
Merged-by: Anna Kozlova <Anna.Kozlova@jetbrains.com>
2023-06-05 10:17:40 +00:00
Egor Kulikov 8ae5336f04 [FIR] Add top level invalid destructuring declarations in classes
Part of ^KTIJ-23263

Merge-request: KT-MR-10424
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-06-02 14:05:00 +00:00
Anna Kozlova faedea6aea [psi] get type text based on provided stubs 2023-05-27 12:22:23 +00:00
Anna Kozlova 71844f81f4 [psi] decompiled code doesn't have function bodies
otherwise AST for decompiled code would be loaded by findChildByClass call

^ KTIJ-25047
2023-05-27 12:22:23 +00:00
Anna Kozlova 360e7d6156 [psi] decompiled code doesn't have documentation
otherwise AST for decompiled code would be loaded by allChildren call

^ KTIJ-25047
2023-05-27 12:22:23 +00:00
Vladimir Dolzhenko 984ab0a4b9 Revert "Drop KtStubElementTypes#FILE"
This reverts commit ae4b0c6fe1.
2023-05-26 15:13:25 +00:00
Kirill Rakhman 0ac02be534 [FIR] Generate annotations to data class copy method parameters
#KT-57003 Fixed
2023-05-26 11:29:13 +00:00
Kirill Rakhman aacdfb67c6 [Stubs] Bump stubs version
#KT-58786
2023-05-19 11:50:40 +00:00
Ilya Kirillov 04cb217791 Fix binary compatibility of KtPsiFactory.contextual
^KTIJ-25307 fixed
2023-05-17 13:09:45 +00:00
Vladimir Dolzhenko 37c493f593 Add missed DOT_DEFAULT_EXTENSION
#KTIJ-25470
2023-05-17 12:45:19 +00:00
Vladimir Dolzhenko ae4b0c6fe1 Drop KtStubElementTypes#FILE
It has been marked as deprecated for a while and targeted to be deleted in 1.9.0

#KT-53781

Merge-request: KT-MR-10082
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
2023-05-11 09:56:55 +00:00
Kirill Rakhman b07e4f26ef [LT, Parsing] Parse blocks and lambdas eagerly for Light Tree 2023-05-05 09:34:23 +00:00
Anna Kozlova 1102dc1d0e [psi] define common constant expressions types 2023-05-02 10:30:34 +00:00
Anna Kozlova 956294821b [psi] don't load text for compiled code
use stubs when possible, when stub doesn't contain anything,
decompiled text won't contain it either,
no sense to load
2023-05-02 10:30:34 +00:00
Andrei Klunnyi 1e0115aef8 KT-57468 Kotlin assignment plugin: operation name cannot be found
The problem results in broken import quick fix and import optimizer on
the IDE side [1].

`AssignResolutionAltererExtension` introduced a possibility to override
 resolution of assignment statements. The inconsistency though is
 that `KtSimpleNameReference.getResolvesByNames` doesn't return a name
 for the overridden `=`. Kotlin as a language doesn't support this [2].

This commit eliminates the drawback above:
1. It fixes the name `assign` the `=` can be resolved to [3].
   This eliminates the need to search for the name, bypassing the
   plugins.
2. `KtSimpleNameReference.getResolvesByNames` returns `assign` among
   other names in case it deals with binary `=` and assignment is
   resolved.
3. `KtCompilerPluginsProvider` was extended to check plugins' presence.
   K1 implementation added.

----------------------------------------------------------------
[1]: https://youtrack.jetbrains.com/issue/KTIJ-24390
[2]: OperatorConventions.getNameForOperationSymbol
     https://kotlinlang.org/docs/operator-overloading.html#augmented-assignments
[3]: OperatorConventions#ASSIGN_METHOD + AssignmentPluginNames
2023-04-27 14:05:02 +00:00
Anna Kozlova a41f7dc25d [cls] save parameter name for functional types in stub
to make it available for deserialized Fir
2023-04-27 11:37:28 +00:00
Anna Kozlova d59d66e876 [AA, LL] use stubs to build deserialized Fir elements in IDE
^KTIJ-24638

Notice on `DebugSymbolRenderer`:
stub based deserializer sets source directly,
but it's available in IDE mode only.
Thus, standalone and IDE tests have different results.
In order to avoid this, sources for compiled code are explicitly ignored

Notice on distinct callables:
for a file which belong to multiple libraries, decompiled code would be build per library.
In order to avoid ambiguity errors for members in that file,
we need to distinct provided elements by origins
failed test from IJ repo:
 FirReferenceResolveWithCrossLibTestGenerated#testSetWithTypeParameters
2023-04-27 11:37:28 +00:00
Anna Kozlova 6ba4e37696 [psi] don't load ast for compiled code
deserialized parameters do not contain real default values anyway
2023-04-27 11:37:26 +00:00
Anna Kozlova 7ee648a4f5 [cls] include annotation arguments in cls stubs
^ KTIJ-24666
this would allow to build fir based on stubs,
do not keep ProtoBuf in memory and
search in decompiled code by stubs
2023-04-26 21:43:15 +02:00
Anna Kozlova f0af7c4228 [cls] include property constant initializer in stubs
^KTIJ-24667
this would allow building FirElements from stubs
2023-04-26 21:43:15 +02:00
Anna Kozlova 70ef87354f [psi] KtValueArgumentName: use stub when possible 2023-04-26 21:43:15 +02:00
Anna Kozlova 171e9db1f8 [psi] don't search for property initializer in decompiled code
it's not included in decompiled text, so can't be found anyway
2023-04-26 21:43:14 +02:00
Anna Kozlova 7021c079c6 [cls] include property accessors in cls stubs 2023-04-26 21:43:14 +02:00
Anna Kozlova 20661d1f95 [cls] more compact representation for contract stubs
distinguish boolean parameters
2023-04-25 10:34:33 +00:00
Anna Kozlova 4fe239375f [cls] write contracts information to cls stubs
^ KTIJ-24665
this information would be used to create resolved FirElements from stubs,
so no ProtoBuf would be kept in memory
2023-04-25 08:34:18 +00:00
Roman Golyshev d4cffb8a5a [213] Switch to 213 platform
KTI-1114
2023-04-21 13:19:04 +00:00
Egor Kulikov c46c922841 [ClsStubs] Add context receivers on function types 2023-04-20 18:57:51 +00:00
Anna Kozlova 04eb02085a [psi] bump stub version
missed from f810d435f4
2023-04-19 19:09:00 +02:00
Ilya Kirillov 2beb4c0017 [PSI] allow creating KtFiles with eventSystemEnabled = true in KtPsiFactory
so we have a VirtualFile for every KtFile created by it

^KT-57930
2023-04-19 16:08:59 +00:00
Mikhail Glukhikh 2ccad553e6 K1/K2: allow to apply suspend modifier to anonymous function
#KT-57991 Fixed
2023-04-17 18:05:44 +00:00
Anna Kozlova f810d435f4 [cls] write flexible type information to cls
^KTIJ-25172
this information would be used to create resolved FirElements from stubs,
so no ProtoBuf would be kept in memory
2023-04-14 18:12:48 +00:00
Yan Zhulanow a350deaa4d [LL API] Support FirScript declarations in declaration providers (KTIJ-21108) 2023-03-14 14:31:53 +00:00
Anna Kozlova 3eddfeb8c9 [psi] make collection literal stub based
^ KT-57035
2023-03-01 16:57:27 +00:00
Anna Kozlova b913b528af [psi] make class literal stub based
^ KT-57033
2023-03-01 16:57:27 +00:00
Egor Kulikov 694ef8e52d [FIR] Use stubs to get context receiver list and name of label
Thirteenth step for ^KT-52615

Merge-request: KT-MR-8911
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-02-21 10:44:02 +00:00
Egor Kulikov d670e5a695 [FIR] Do not get expressions from contract effect list in lazy mode
Eleventh step for ^KT-52615
2023-02-16 17:18:10 +00:00
Egor Kulikov 32c3b0cd58 [FIR] Use stubs for creating lazy bodies of backing field initializer
Ninth step for ^KT-52615

Merge-request: KT-MR-8756
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-02-10 10:02:39 +00:00
Egor Kulikov 8b1e508740 [FIR] Make check for dangling modifier lists use stubs
Seventh step for ^KT-52615

Merge-request: KT-MR-8651
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-02-03 12:21:58 +00:00
Anna Kozlova 6f9cfe1943 [AA] don't treat broken code as function type parameter
inspired by KTIJ-23940
2023-01-17 11:50:20 +00:00
Egor Kulikov 842ad56266 [PSI] Fix highlightning hangs in libraries
Fixes ^KTIJ-23875
findChildrenByType was errorneously replaced with
getStubOrPsiChildrenAsList

Merge-request: KT-MR-8165
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-01-16 17:24:05 +00:00
Vladimir Dolzhenko 4466b2c980 Mark KtStubElementTypes#FILE will be deleted in 1.9.0
#KT-53781
2023-01-08 21:43:26 +01:00
Vladimir Dolzhenko 4542b3947b Clean up: rename Jet* to Kt* 2023-01-03 16:36:53 +01:00
Jaebaek Seo a637626601 Handle context receiver in KtModifierListOwner.addModifierList()
The existing `KtModifierListOwner.addModifierList(newModifierList)`
function adds a visibility keyword (e.g., `private`) in front of the
`context(..)` modifier, which generates wrong code. This commit fixes
it.

^KTIJ-23728 fixed
2022-12-05 11:20:03 +01:00
Vladimir Dolzhenko af08e4121d Fix fragment element types class hierarchy.
They must not extend `IStubFileElementType`.

#KT-55160 Fixed
2022-11-28 15:44:37 +00:00