Commit Graph

3028 Commits

Author SHA1 Message Date
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 d89aafb06c [AA] Resolve package fqName in KDoc 2023-07-04 16:34:52 +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
Kirill Rakhman 6d1d6e48c1 [FIR] Rename qualifiedAccessOrAssignmentsOrAnnotationCalls to callsOrAssignments and add delegated constructor calls 2023-07-04 16:00:45 +00:00
Dmitrii Gridin 09ca335b7e [FIR] CFG: drop redundant edges
Edges from class to its functions and nested classes are redundant
and lead to extra resolution work in lazy resolve mode

^KT-59600 Fixed
2023-07-04 12:07:04 +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
Yan Zhulanow 8bf8b7b35b [LL API] Minor, prettify deserialized callable loading 2023-07-04 11:17:39 +00:00
Dmitrii Gridin 050c66ea81 [FIR] add missing Any super type to Cloneable
^KTIJ-24272 Fixed
2023-07-04 10:20:37 +00:00
Dmitrii Gridin a81523fa74 [LL FIR] mark entire delegate as lazy expression
To simplify modification and restoring

^KT-59687
2023-07-04 10:09:51 +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
Denis.Zharkov 12dcfd25e6 K2: Fix test state for KT-51670 before the fix 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
Anna Kozlova f96b5bae48 [LL] anchor module provider for navigation in monorepo
Use information from IDE about anchor module,
to include everything from that module and dependencies into library session
^ KTIJ-24683
2023-07-03 17:10:51 +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 d7d2c1f260 KTIJ-26024 [Analysis API] Refactor FirTowerDataContextAllElementsCollector 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 36c8987df2 [FIR] fix exception on primary constructor parameter without a type
^KTIJ-25869 fixed
2023-07-03 11:40:18 +00:00
Kirill Rakhman cfc824f9f2 [FIR] Set vararg modifier on data class copy method parameters
This only happens in red code, but it prevents unhelpful initializer
type mismatch errors.
2023-07-03 10:11:36 +00:00
Anna Kozlova 600b5ec6e5 [FIR] preserve real source for property accessors
^ KT-59705
If property is delegated, it can't have property accessors with non-default impl,
but it can contain property accessors declarations
with non-default visibility, annotations, etc.
Seems, it's more logical to preserve them as fake sources
than use property itself
2023-07-03 08:46:40 +02:00
Denis.Zharkov 1f120ecd20 K2: Adjust invoke priorities with K1
- At first, get rid of a kind of interceptTowerGroup callback and use
explicit towerGroup construction instead
- Get rid of INVOKE_RECEIVER (not sure exactly why it was needed)
- Make comparison consistent with tower-levels priority of K2
(see the comments in the compareTo code)

^KT-37375 Fixed
^KT-58940 Open
2023-07-01 16:29:05 +00:00
Denis.Zharkov acb1859154 K2: Fix current behavior for KT-37375 and KT-58943 2023-07-01 16:29:04 +00:00
Denis.Zharkov b18b2abe05 K2: Add test describing the state for KT-59789 2023-07-01 16:27:23 +00:00
Anastasia.Nekrasova 62d8d04b51 [Test] Add a test covering missed error for virtual inline vals in enum classes
Addition to inline functions that are already present in tests.

^KT-34372
2023-07-01 15:10:05 +00:00
Yan Zhulanow d04ed56a4d [LL API] Add tests for FIR tree guards
^KT-59297 Fixed
2023-06-30 14:26:43 +00:00
Yan Zhulanow 91c3ebac27 [LL API] Replace whole-session invalidation with granular FIR guards
^KT-59297 Fixed

'ProcessCancelledException's are commonly thrown during code analysis,
yet not every place is ready for them. As a FIR tree is a mutable data
structure with no transaction support, sporadic halts during its
mutation might easily leave it in an inconsistent state.

Before this change, whole module sessions (with all dependents) were
invalidated if an exception occurred during their analysis. Not only it
was very ineffective, it also resulted into a concurrency problem.

'ProcessCancelledException's are thrown when an underlying progress
indicator is invalidated. As analysis in each thread might have its own
progress indicator, invalidation in one thread should not stop
analysis in others. However, it is impossible in the current state,
as all threads share the same FIR tree structure.

The change introduces 'FIR guards' – a set of instructions defining
preservation and restoration rules for individual state items. As each
resolution phase is supposed to modify only a (sort of) known subset
of tree elements, restoration of potentially changed state on a failure
effectively returns the tree consistency.

Note that guards are not defined for certain phase transformers. The
reason is that the transformers already update the tree content safely.
E.g., the type reference is updated once it is resolved, and already
resolved type references are either resolved the same way again, or
just skipped on consequent phase runs.
2023-06-30 14:26:43 +00:00
Yan Zhulanow d386dd1f7b [LL API] Minor, prettify naming in 'LLFirBodyLazyResolver' 2023-06-30 14:26:43 +00:00
Yan Zhulanow 2aaf589ef2 [LL API] Minor, simplify call sites in 'transformAnnotations()' 2023-06-30 14:26:43 +00:00
Yan Zhulanow c7c49fd267 [LL API] Minor, clean up 'handleExceptionFromResolve()' 2023-06-30 14:26:42 +00:00
Ilya Kirillov 5b4916a808 Introduce StandardNames.IMPLICIT_LAMBDA_PARAMETER_NAME
and use it instead of hardcoded constant
2023-06-30 13:43:31 +00:00
Ilya Kirillov 0a1f27e43a [LC] remove duplicating checkIsMangled function 2023-06-30 13:43:30 +00:00
Ilya Kirillov c4e8a6dee9 [SLC] implement isMangled for symbol light method
`isMangled` is needed for implementing rename refactoring

^KTIJ-25903
2023-06-30 13:43:30 +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
Kirill Rakhman 2cc588d6d8 [RAW FIR] Rename raw FIR builder types for clarity 2023-06-30 12:05:43 +00:00
Ilya Kirillov 26e9e9de11 [LL FIR] add regression tests for KTIJ-23090
^KTIJ-23090 obsolete
2023-06-30 11:13:47 +00:00
Ilya Kirillov 048ecdf981 [Analysis API] add regression tests for KTIJ-24163
^KTIJ-24114 obsolete
2023-06-30 11:13:46 +00:00
Jinseong Jeon f467c970b2 Drop param name check in PSI-KtSymbol eq checker
Parameter names might not be available, e.g., header jar (ijar).
2023-06-29 14:44:41 +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
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 0d19a5b3ea AA: make paths platform-independent before using JRT file system
^KT-59697 Fixed
2023-06-28 22:13:16 +02: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
Dmitrii Gridin 6553290b05 [LL FIR] FirElementFinder: drop obsolete debug info
Issue with CME already fixed in LL FIR some time ago
2023-06-28 10:34:04 +00:00