Commit Graph

688 Commits

Author SHA1 Message Date
Pavel Mikhailovskii bbbca94d3c [Analysis API] Get rid of automatic registration of KtLifetimeTokenProvider in StandaloneAnalysisAPISessionBuilder. Introduce KtAlwaysAccessibleLifetimeTokenProvider. 2023-07-26 15:47:05 +00:00
aleksandrina-streltsova 1c472c2751 [AA] update test data after adding properties to callable symbols
KT-54846
2023-07-24 17:24:42 +00:00
aleksandrina-streltsova fe4ca30c55 [AA] implement isExpect/isActual for callable symbols
^KT-54846 Fixed
2023-07-24 17:24:42 +00:00
aleksandrina-streltsova 52a95cb75f [AA] update test data after adding properties to KtClassLikeSymbol
KT-54846
2023-07-24 17:24:41 +00:00
aleksandrina-streltsova ca25162574 [AA] implement isExpect/isActual for KtClassLikeSymbol
KT-54846
2023-07-24 17:24:41 +00:00
aleksandrina-streltsova 20598cf7d7 Revert "[Analysis API] Add API for expect/actual declaration detection"
This reverts commit 338c2433ac.
2023-07-24 17:24:40 +00:00
Anna Kozlova 40a6c81d97 [AA] retrieve overridden symbols for parameter from generated property
Merge-request: KT-MR-11215
Merged-by: Anna Kozlova <Anna.Kozlova@jetbrains.com>
2023-07-24 11:09:56 +00:00
Dmitrii Gridin 88da053408 [AA] forbid analyze from write action
Analysis is not supposed to be called from write action.
Such actions can lead to IDE freezes and incorrect behavior

^KT-60586 Fixed
2023-07-21 13:03:04 +00:00
Roman Golyshev b8052761db KT-60341 [Analysis API] Provide a type for a FirNameReference only when it refers to an actual property/variable
We cannot always return null, because in such case some expressions
would become not fully explorable from the types perspective (see
the documentation on the `getCorrespondingTypeIfPossible`)

`FirNamedReference` might appear when resolving method references (like
`foo::bar`), but also when IJ Platform tries to resolve other parts of
the Kotlin PSI, notably a `KtNameReferenceExpression` in a
function call (`bar` in `foo.bar(baz)` expression).

N.B. FE10 implementation does not support returning `null` as a type -
currently it always returns `Unit` type in case it cannot figure out
the actual type. This issue should probably be tackled together with
KT-60166, so that both implementations are more or less aligned

^KT-60341 Fixed
^KT-59077 Fixed
^KTIJ-25745 Fixed
2023-07-19 22:01:37 +00:00
Kirill Rakhman 97024d9ccb [FIR] Resolve array literal argument for non-primitive-array parameter as arrayOf call in annotation calls
This allows us to properly complete array literals arguments of
annotation calls fixing several false-negative type mismatch errors
as well as enabling the inference of generic type arguments.

#KT-59581 Fixed
#KT-58883 Fixed
2023-07-19 13:34:58 +00:00
Roman Golyshev 5e30adec06 KTIJ-26276 [Analysis API] Do not consider single aliased import from the same package as unused
Even when the aliased import comes from the same package, it cannot be
removed, because it will break the code

Also, add more tests for the imports coming from the same package

^KTIJ-26276 Fixed
2023-07-19 12:40:57 +00:00
Ilya Kirillov 08400d930f [Analysis API, FIR] migrate ::class.java -> ::class inside error messages
They seem to provide similar results and the `.java` part is redundant
2023-07-18 11:49:21 +00:00
Ilya Kirillov 4b523825be [Analysis API] forbid providing custom KtLifetimeToken for every analyze call
^KT-60488 fixed
2023-07-18 08:47:34 +00:00
Justin Paupore 9f85739599 [AA] Add KtResolveExtensionInfoProvider to AA.
This provider is responsible for answering queries related to resolve
extensions. At the moment, this includes retrieving a KtScope with all REx
top-level declarations (moved from KtSymbolFromResolveExtensionProvider), and
retrieving information necessary to supply a GeneratedSourcesFilter for REx
generated code. Future REx-related functions can be added to this interface.

^KT-59329
2023-07-14 19:32:09 +02:00
Justin Paupore fa0209a322 [AA] Expand functionality of TestScopeRenderer.
- Add package and constructor listings
- Add single-scope renderForTests() implementation, including a lambda
  to provide additional information about each symbol
- Remove special handling for empty scopes (interfered with single-scope
  rendering)

^KT-59329
2023-07-14 19:32:08 +02:00
Justin Paupore f01b824751 [AA] Show symbol origins in REx tests.
This is in preparation for adding a separate KtSymbolOrigin for
resolve extension symbols.

^KT-59351
2023-07-14 19:32:08 +02:00
Justin Paupore 734b87b97e [AA] Allow specifying REx file contents in testdata.
Tests can now specify the code generated by a resolve extension from
within the test's testdata. Module-level directives control whether
resolve extensions are enabled for that module, as well as package names
and source shadowing regexes. File-level directives allow a `// FILE:`
block within the testdata to be converted into a KtResolveExtensionFile
and removed from the module as a whole. (This requires a new
`ModuleStructureTransformer`, because we need to be able to entirely
remove the files in question.)

Any test can add support for these directives by calling
`KtResolveExtensionTestSupport.configure` from within their
`configureTest` stanza. This allows this functionality to be used in
conjuction with any test base class.

^KT-59329
2023-07-14 19:32:08 +02:00
Andrei Klunnyi 0323b0fb19 KT-59801 [FIR] scripting: tests for reference shortening 2023-07-13 15:21:39 +02:00
Mikhail Glukhikh 9d9d7880af K2: render types in quotes in diagnostic messages 2023-07-13 09:07:39 +00:00
Mikhail Glukhikh c839cd3c11 K2: don't use debugging type renderer in error messages 2023-07-13 09:07:39 +00:00
Bart van Helvert 362675a1b5 [AA] Support getting type from get and set annotation calls
#KTIJ-26206 Fixed
2023-07-07 12:57:45 +00:00
Egor Kulikov 27f4b53570 [FIR] Do not expect builtin imports to be always resolved
Merge-request: KT-MR-10886
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-07-05 14:02:50 +00:00
aleksandrina-streltsova 116de97f54 [AA] Add synthetic properties scopes to scope context for position 2023-07-05 12:36:54 +00:00
aleksandrina-streltsova 39bdd67df6 [AA] Shortener: change test data
Remove ON_AIR_CONTEXT_CARET_TAG where it's not necessary
2023-07-04 16:34:53 +00:00
aleksandrina-streltsova 9766270afa [AA] Shorten kdocs that became available because of newly added imports 2023-07-04 16:34:52 +00:00
aleksandrina-streltsova 88f2bf85eb [AA] Test shortener for the whole file with different options 2023-07-04 16:34:51 +00:00
aleksandrina-streltsova 67c3849538 [Analysis API] Shortener: enable shortening in KDoc
^KTIJ-21103
2023-07-04 16:34:51 +00:00
Kirill Rakhman e7c213e06e [FIR] Report separate error for delegated constructor call to interface
#KT-59216 Fixed
2023-07-04 16:00:45 +00:00
Denis.Zharkov 78e2d53f3c K2: Adjust Analysis API to the recent scope structure changes
Namely, in the previous commit we merged two
(LOW and HIGH priority default start import scopes) into the single one

For more explanations, please look at the previous commit
2023-07-04 07:25:22 +00:00
Roman Golyshev c5ded1ba48 KTIJ-26103 [Analysis API] Ignore implicit dispatch receivers in Reference Shortener
Calls to extension functions imported from objects have implicit
dispatch receivers, but those receivers are not present in the code
and should not be analyzed by the shortener

^KTIJ-26103 Fixed
2023-07-03 20:05:09 +00:00
Roman Golyshev ab149e1053 KTIJ-26024 [Analysis API] Add more tests for nested cases of reference shortening in class header
Account for `FirNestedClassifierScopeWithSubstitution` in the reference
shortener
2023-07-03 16:21:42 +00:00
Roman Golyshev 88450c69b3 KTIJ-26024 [Analysis API] Provide correct context for class header from FirTowerDataContextAllElementsCollector
To correctly provide the context for class header resolution, we save
the additional copy of the context right before `withRegularClass`
wrapper call in `LLFirBodyLazyResolver`. Otherwise we would have to
clear the existing context by hand, which is too cumbersome
(if at all possible)

^KTIJ-26024 Fixed
^KTIJ-24832 Fixed
2023-07-03 16:21:42 +00:00
Roman Golyshev 96697b5a77 KTIJ-26024 [Analysis API] Rearrange testData for reference shortener
Move testData for nested classes' scopes to a separate directory
2023-07-03 16:21:42 +00:00
aleksandrina-streltsova 57cbab7d8e [AA] Shortener: allow import if requested import kind has high priority 2023-07-03 15:08:05 +00:00
aleksandrina-streltsova a96e2f37e7 [Analysis API] Shortener: don't add import if it affects usages
^KTIJ-24096 Fixed
2023-07-03 15:08:04 +00:00
aleksandrina-streltsova 338c2433ac [Analysis API] Add API for expect/actual declaration detection 2023-07-03 15:08:04 +00:00
aleksandrina-streltsova da5f33d762 [Analysis API] Do not shorten qualifiers outside the selection range
^KTIJ-25116 Fixed
2023-07-03 15:08:04 +00:00
aleksandrina-streltsova ed7a3299f0 [Analysis API] Shorten qualifier of unresolved reference
^KTIJ-25115
2023-07-03 15:08:03 +00:00
Ilya Kirillov 8b0eb0488f [Analysis API] add method for implicit companion object reference detection
Add a new method `isImplicitReferenceToCompanion` to determine
if the given reference is an implicit reference to a companion object.

The method is needed for the rename refactoring in IJ.

^KTIJ-25863
2023-06-30 13:43:30 +00:00
Ilya Kirillov 048ecdf981 [Analysis API] add regression tests for KTIJ-24163
^KTIJ-24114 obsolete
2023-06-30 11:13:46 +00:00
aleksandrina-streltsova 4ccea40651 [AA] Provide API for obtaining array element type of KtType
KTIJ-23199
2023-06-29 09:41:40 +03:00
Jinseong Jeon a93bc60655 AA: use simple name of local type as JVM internal name
Otherwise, e.g., if a local type is within an anonymous object, full
class id will include that anonymous object too, resulting in invalid
type signature for PsiType.

^KT-59533 Fixed
2023-06-28 18:38:01 +02:00
Egor Kulikov d17c7d4729 [FIR] Correctly mute destructuring declaration test for 1.0
Merge-request: KT-MR-10847
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-06-27 16:17:07 +00:00
Egor Kulikov a7c1f53af8 [FIR] Correctly process invalid destructing declarations
^KTIJ-24730 fixed

Merge-request: KT-MR-10712
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2023-06-27 09:54:01 +00:00
Anna Kozlova ce76db1636 [AA] introduce KtKeywordsRenderer to support nonmodifier keywords filter 2023-06-26 16:21:20 +00:00
Roman Golyshev a436f11caf [Analysis API] Add useful references to reference shortener APIs 2023-06-26 14:37:14 +02:00
Roman Golyshev b4c9a2616e KTIJ-25960 [Analysis API] Resolve static declarations in KDoc
^KTIJ-25960 Fixed
2023-06-26 12:27:26 +00:00
Jinseong Jeon e0fc0d96e5 AA: handle PsiType conversion for recursive type parameter case
^KT-59598 Fixed
2023-06-23 16:31:47 +02:00
aleksandrina-streltsova 3477d35168 [AA] Provide expected type for annotation entry argument
^KTIJ-19863
2023-06-22 12:33:51 +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