Commit Graph

2957 Commits

Author SHA1 Message Date
Pavel Mikhailovskii 9f763deea1 KT-59325 [SLC] Fix generation of fields from companion objects 2023-06-22 14:48:12 +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
Vladimir Dolzhenko d0477a6a30 Provide equals/hashCode based on original PSI to avoid potential PCEs
#KT-59445
2023-06-22 14:14:18 +00:00
Anna Kozlova abdc44c18a [LL] support search for decompiled fir for type parameters
^ KTIJ-25976
2023-06-22 12:51:44 +00:00
aleksandrina-streltsova 3477d35168 [AA] Provide expected type for annotation entry argument
^KTIJ-19863
2023-06-22 12:33:51 +00:00
Mikhail Glukhikh 7884d9a61e K2: reproduce KT-54917 2023-06-22 12:29:11 +00:00
Dmitrii Gridin b22769919e [LL FIR] LLFirProvider: do not return unrelated FirFile for synthetic declarations
We do not expect to get a FirFile that is not associated with our requested element

^KT-59505
2023-06-22 10:22:37 +00:00
Dmitrii Gridin 34a871e0b0 [LL FIR] LLFirProvider: move backing field check to helper function
^KT-59505
2023-06-22 10:22:37 +00:00
Dmitrii Gridin f74d4494aa [LL FIR] fix designation path for synthetic declarations
A designation path for synthetic declarations like fake override
or member delegate contained the wrong FirFile, because it
was provided by the original declaration that is wrong.
So we should pick up the file from our path, because it shouldn't be
synthetic

^KT-59505 Fixed
2023-06-22 10:22:37 +00:00
Jinseong Jeon 799aadfacf AA: add an option to create Application env for production v.s. test mode
...and use production mode by default for AA standalone

^KT-59511 Fixed
2023-06-22 11:32:29 +02:00
Pavel Mikhailovskii 134b02c754 KT-59563 [SLC] Fix type erasure in $annotations methods of extension properties 2023-06-22 09:06:12 +00:00
Kirill Rakhman 6318da0f02 [FIR] Remove or replace whole expressions in FIR diagnostic messages
FIR expressions rendered by FirRenderer don't look very nice in error
messages anyway, and additionally, they can become arbitrarily large,
so we shouldn't use them in messages.

#KT-59449 Fixed
2023-06-22 08:02:07 +00:00
Dmitriy Novozhilov 6c7eb0167c [FIR] Report errors about type arguments on resolved qualifiers
^KT-56186 Fixed
^KT-56187 Fixed
^KT-59553
2023-06-22 07:09:15 +00:00
Roman Golyshev ac92c129bf KT-59093 [Analysis API] Remove unnecessary resolveCall overloads from KtCallResolverMixIn
^KT-58161 Fixed
2023-06-21 20:40:22 +00:00
Roman Golyshev 50c93b0228 KT-59093 [Analysis API] Make all resolveCall overloads nullable
Instead of returning an error which does not mean anything specific,
it's easier just to return `null`
2023-06-21 20:40:22 +00:00
Roman Golyshev c81b22e7de KT-59093 [Analysis API] Remove error logging from KtFirCallResolver
There are too many possible error cases when code resolution cannot
properly resolve a call. Since in external mode `Logger.error` calls
lead to visible IDE errors, we want to avoid that

^KT-59093 Fixed
2023-06-21 20:40:21 +00:00
Bart van Helvert 807df9a120 [AA] Properly render type arguments in short name renderer
Render type arguments for short names without nested qualifier.
2023-06-21 18:51:57 +00:00
Roman Golyshev 26dbeb9b6f KTIJ-25530 [Analysis API] Add missing test cases for Java statics
Can be done now because KT-58980 is fixed
2023-06-21 18:37:09 +00:00
Mikhail Glukhikh 78f4d399d4 FE: add test to ensure Java entries static field is resolved normally 2023-06-21 13:08:01 +00:00
Mikhail Glukhikh 905e1dcd3b K2: introduce prioritized enum entries resolve by a 2.1 feature
Related to KT-48872
2023-06-21 13:08:01 +00:00
Mikhail Glukhikh 70899d492d K2: reproduce KT-57954 and reorganize tests around enum entries warnings
In particular, here we add FIR_DUMP to all enum entries tests with
some deprecation diagnostics and the feature on, and remove all txt-files
2023-06-21 13:08:00 +00:00
Ilya Kirillov 0ad98ff610 [Analysis API] use fe10-specific testdata for Fe10IdeNormalAnalysisSourceModuleAnalysisApiImportOptimizerTestGenerated 2023-06-21 12:04:31 +02:00
Ilya Kirillov 7be17a80ce [Analysis API] regenerate Fe10IdeNormalAnalysisSourceModuleAnalysisApiImportOptimizerTestGenerated 2023-06-21 12:04:31 +02:00
Mikhail Glukhikh 7fd441f16a Analysis API: add normal FE10 import optimizer (taken from plugin code) 2023-06-21 12:04:31 +02:00
Jinseong Jeon b91a23be12 Reintroduce KtLightClassForScript as a common interface between (U|S)LC
...so that UAST's conversion to KotlinScriptUClass can work for both LCs
2023-06-21 11:14:15 +02:00
Jinseong Jeon 618d6526a7 Rename KtLightClassForScript to reuse it for common interface between LCs 2023-06-21 11:14:15 +02:00
Kirill Rakhman 911e62257a [FIR] Improve INVISIBLE_REFERENCE message
Report the nearest invisible containing declaration in cases where
the declaration itself is visible.

#KT-53820 Fixed
2023-06-21 08:36:46 +00:00
Kirill Rakhman 7abeb05c8d [LL] Deserialize nested typealiases from stubs 2023-06-21 07:34:29 +00:00
Kirill Rakhman d7effec4e8 [LL] Set publishedApiEffectiveVisibility on deserialized declarations from stubs
#KT-58641
2023-06-21 07:34:29 +00:00
Dmitriy Novozhilov 8a1372e21c [Test] Add test for KT-58754 2023-06-21 06:57:42 +00:00
Anna Kozlova a0f7656d2b [AA] provide parameters renderer without name/default value
used to have such renderer in file structure
2023-06-20 20:10:33 +00:00
Egor Kulikov b147b7e929 [FIR] Store fir for invalid when branches
^KTIJ-25646 fixed

Merge-request: KT-MR-10646
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-06-20 16:11:31 +00:00
Jinseong Jeon 37876313c9 SLC: add nullity annotation when force-boxing return type
^KT-57579 Fixed
2023-06-20 15:43:41 +00:00
Mikhail Glukhikh 8983e3a218 K2: correctly set importedFromObjectOrStaticData for fields
#KT-59140 Fixed
#KT-58980 Fixed
2023-06-20 14:13:21 +00:00
Mikhail Glukhikh 18206210cf K2: reproduce KT-59140 2023-06-20 14:13:21 +00:00
Nikolay Lunyak 46ea908daf [Tests] Ensure the temporary directories are cleared
This change may prevent OOMs. Context:
https://jetbrains.slack.com/archives/C4U955N6B/p1685000899030279
2023-06-20 13:28:23 +00:00
Pavel Mikhailovskii 79dbacb621 [SLC] Keep default constructor parameters' values 2023-06-20 11:00:18 +00:00
Roman Golyshev bccd7bc04a KTIJ-25341 [Analysis API] Visit component calls in import optimizer
N.B. K2 does not require resolved `componentX` functions for the
placeholder variables (`_`), see KT-59504

^KTIJ-25341 Fixed
2023-06-20 10:12:57 +00:00
Mikhail Glukhikh d8a20f1975 K2: don't generate Java overridden synthetics for Kotlin get/sets
#KT-59038 Fixed
2023-06-20 07:07:10 +00:00
Egor Kulikov 5bb4f469ef [FIR] Do not throw exception on unexpected FIR for constants
^KTIJ-23263 fixed

Merge-request: KT-MR-10699
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-06-19 17:45:31 +00:00
Roman Golyshev adab552928 KTIJ-25530 [Analysis API] Correctly collect references to implicitly dispatched callables in Import Optimizer
N.B. There is a case which is not covered ATM due to the bug in the
compiler, see KT-58980

^KTIJ-25530 Fixed
2023-06-19 16:02:09 +00:00
Mikhail Zarechenskiy 060f3fa7c4 Extract diagnostics about class literals with empty LHS
^KT-59152
2023-06-19 15:21:32 +00:00
Anna Kozlova 583aad2350 [LL] spare some memory on lists
By default, a list with a single element would have capacity of 10;
in big numbers, it might be a lot of wasted memory.
2023-06-19 10:33:12 +00:00
Dmitrii Gridin 8cdba7b9e7 [LL FIR] KtFirVisibilityChecker: use getOrBuildFirSafe instead of resolveToFirSymbol againg
It is unexpected, but getOrBuildFirSafe here now works better than resolveToFirSymbol

^KT-59266
^KT-59453 Fixed
2023-06-17 18:04:59 +00:00
Dmitrii Gridin 72c625906f [LL FIR] add tests on ClassIdCalculator 2023-06-17 13:58:24 +02:00
Dmitrii Gridin fc7712148e [LL FIR] avoid ClassId computation to check isLocal 2023-06-17 13:58:24 +02:00
Brian Norman 0ff9982b31 [FIR] Additional errors to distinguish resolution to classifier cases
When a call is resolved to a classifier, only a single error message was
being used for multiple cases. This lead to confusion as the default
message may not be applicable to a given error case. Added additional
errors and messages to distinguish between these error cases.

#KT-57251 Fixed
2023-06-16 16:26:50 +00:00
Dmitrii Gridin 13732881a6 [AA FIR] reduce resolve calls
^KT-59266
2023-06-16 14:47:49 +00:00
Dmitrii Gridin 87ca9e4203 [LL FIR] reduce resolution inside getOrBuildFirFor
We can avoid body resolution in some cases because it is more
than out contract is required

So ANNOTATIONS_ARGUMENTS_MAPPING should be enough for all
non-body parts of a declaration to return fully-resolved FirElement
Body parts incudes: body and default values

^KT-59266 Fixed
2023-06-16 14:47:49 +00:00
Dmitrii Gridin b9e24e9b19 [LL FIR] add more tests on getOrBuildFirFor
^KT-59266
2023-06-16 14:47:49 +00:00