Commit Graph

2717 Commits

Author SHA1 Message Date
Mikhail Glukhikh 134284e496 FE: add test for KT-58055 2023-05-11 12:19:40 +00:00
Pavel Mikhailovskii 25c0725da9 [SLC] Treat error class types as not-nullable 2023-05-11 11:48:45 +00:00
Dmitrii Gridin 9a267176f5 [FIR] move deprecation calculation to COMPILER_REQUIRED_ANNOTATIONS phase
Also, this change adds SinceKotlin and Java.Deprecated to this phase
It fixes some problems with API_NOT_AVAILABLE, so now it is closer to K1

^KT-57648 Fixed
^KT-55723 Fixed
2023-05-11 10:31:52 +00:00
Dmitrii Gridin add47aa041 [FIR] provide correct origin and source to default backing field
Now it is aligned with default accessors
Covered by
analysis/analysis-api/testData/symbols/symbolByReference/accessorField.kt
test

^KT-57648
^KT-55723
2023-05-11 10:31:52 +00:00
Dmitrii Gridin aa5261395e [LL FIR] allow parallel resolve for non-jumping phases
^KT-56550 Fixed
2023-05-10 17:17:46 +00:00
Dmitrii Gridin 7f778eafa5 [LL FIR] add missing declarations transformations for COMPILER_REQUIRED_ANNOTATIONS phase
The transformed does nothing previously

^KT-56550
2023-05-10 17:17:46 +00:00
Dmitrii Gridin 231c59bd2c [LL FIR] drop redundant lazy annotations calculation from ANNOTATIONS_ARGUMENTS_MAPPING phase
They must be calculated on the previous ARGUMENTS_OF_ANNOTATIONS phase

^KT-56550
2023-05-10 17:17:46 +00:00
Dmitrii Gridin a429367890 [LL FIR] unify annotation transformers
^KT-56550
2023-05-10 17:17:46 +00:00
Dmitrii Gridin 5ebba92a6e [LL FIR] FirLazyBodiesCalculator: do not calculate annotations during body calculation
All annotations must be calculated on the corresponding phases

^KT-56550
2023-05-10 17:17:46 +00:00
Dmitrii Gridin 6b8b5c256d [LL FIR] FirLazyBodiesCalculator: cleanup naming
^KT-56550
2023-05-10 17:17:46 +00:00
Dmitrii Gridin 64c2ba1a2a [LL FIR] calculate lazy annotations only for target declaration
To avoid visiting not locked declarations

^KT-56550
^KT-58495 Fixed
^KT-58500 Fixed
^KT-58493 Fixed
^KT-58496 Fixed
^KT-58497 Fixed
^KT-58499 Fixed
^KT-58491 Fixed
2023-05-10 17:17:46 +00:00
Dmitrii Gridin 5c8045f3d0 [LL FIR] add test on nested declarations and annotations
To see the effect of subsequent changes

^KT-56550
2023-05-10 17:17:46 +00:00
Dmitrii Gridin 990f23a11b [LL FIR] FirLazyBodiesCalculator: covert non-public api to private functions
^KT-56550
2023-05-10 17:17:46 +00:00
Dmitrii Gridin a7692ba2c5 [LL FIR] do not calculate lazy body recursively by default
To avoid visiting not locked declarations

^KT-56550
2023-05-10 17:17:45 +00:00
Dmitrii Gridin d1f3ba0286 [LL FIR] cleanup LLFirBodyTargetResolver
Avoid redundant withRegularClass call

^KT-56550
2023-05-10 17:17:45 +00:00
Dmitrii Gridin b51a416682 [LL FIR] ignore constructors on implicit body phase
^KT-56551
2023-05-10 17:17:45 +00:00
Dmitriy Novozhilov 40b8b682f9 [FIR] Don't save DFA implications for unstable local vars
^KT-57502 Fixed
2023-05-10 14:19:25 +00:00
Egor Kulikov 6f20ac4f38 [FIR] Enable asserts for not building AST tree in lazy mode
Make interface delegate expressions lazy
2023-05-10 11:49:42 +00:00
Kirill Rakhman b2fa104081 [FIR] Keep all failed resolution candidates and fully resolve them
Previously, when a candidate was found with an applicability that is
better than the current best applicability, all previous candidates were
thrown away. Now we keep them, unless the new applicability is
successful. If no successful candidates are found, we fully resolve all
the unsuccessful ones and select the ones with the least bad
applicability. This improves diagnostics for unresolved calls.

#KT-57844 Fixed
2023-05-10 11:48:58 +00:00
Anna Kozlova e6b8a09375 [AA] assert that shortener is not called on compiled code
KTIJ-25188


Co-authored-by: Roman Golyshev <anstreth@gmail.com>

Merge-request: KT-MR-10064
Merged-by: Anna Kozlova <Anna.Kozlova@jetbrains.com>
2023-05-10 11:12:05 +00:00
Dmitrii Gridin b3aa2dd60f [LL FIR] calculate designation path by FirFile where it is possible
This will fix problems with declaration clash.
Otherwise, a designation path to the constructor of the second class
from the snippet
```
class A
class A
```
Will contain the first class instead of the second

Also, this is more performed than trying to find a segment of
a path by providers

^KT-58546 Fixed
2023-05-10 09:59:15 +00:00
Dmitrii Gridin ae88726fae [FIR] treat constructors of local classes as local declarations
The main problem: we are trying to lazily resolve local declaration

^KT-58546
^KT-58490
2023-05-10 09:59:15 +00:00
Dmitriy Novozhilov 1936658e40 [FIR] Consider stability of receiver for DFA variables
^KT-57425 Fixed
2023-05-10 07:50:31 +00:00
Dmitrii Gridin 2c294cba64 [FIR] SupertypeComputationSession: fix false positive invisible reference for local object
The problem is that FirAnonymousObject was ignored during getResolvedSuperTypeRefsForOutOfSessionDeclaration from SupertypeSupplier

^KT-58583 Fixed
2023-05-09 17:23:45 +00:00
Roman Golyshev 7a9021aa6b [AA FIR] KT-58503 Do not use resolvedStatus for visibility yet
It's done to avoid lazy resolve contract violation errors. See KT-58572
2023-05-09 13:20:17 +00:00
Roman Golyshev 105611679e [AA FIR] KT-58503 Use resolvedStatus to access visibility and modality of a class
Compiler plugins (AllOpen, for example) can modify the status of a
declaration, including visibility and modality. If we observe them
without enforcing STATUS resolve, we risk to see incorrect information,
which in turn can lead to false negatives/positives in
inspections/intentions.

Add test for light classes. See KT-58503 description for the explanation
how the initial problem was influencing Spring inspections from intellij
repository.

^KT-58503 Fixed
2023-05-09 13:20:16 +00:00
Mikhail Glukhikh 0906258d03 K2: handle suspend anonymous functions properly in various compiler parts
#KT-58332 Fixed
2023-05-09 09:19:38 +00:00
Dmitriy Novozhilov af60681705 [FIR] Save declarations in metadata in source order
^KT-54792 Fixed
^KT-54801
^KT-54800
2023-05-09 07:36:32 +00:00
Anna Kozlova cf6a06fd14 [LL] [cls] don't access index to retrieve fir for given ktElement
also don't check name pattern, because
given ktElement proves that corresponding package contains something
2023-05-09 07:36:11 +00:00
Anna Kozlova 366c67a668 extract StandartNames.NAME constant 2023-05-09 07:36:10 +00:00
Anna Kozlova 92b6a77431 [LL] [cls] remove search for sources for decompiled FIR
stub based deserializer provides sources during initialization,
no need to search afterward
2023-05-09 07:36:10 +00:00
Anna Kozlova 5ca052f87b [LL] [cls] use stubBased symbol provider for builtins
this gives the following benefits:
1. no protobuf in memory, all data is already present in stubs
2. given that symbol provider for libraries is already stub based,
we can get rid of complicated code to find source psi by deserialized fir
3. it's also possible to reduce number of index access,
when fir is requested for given ktElement
2023-05-09 07:36:09 +00:00
Yahor Berdnikau d57623891d Fix explicit api issues in analysis modules
Explicit api mode was not working due to the bug.

^KT-57653
2023-05-08 19:43:43 +00:00
Dmitrii Gridin d3043b6f1c [LL FIR] do not treat declarations from object literal as non-local
^KTIJ-25437 Fixed
2023-05-08 16:08:26 +00:00
Dmitrii Gridin 25f2c513f6 [LL FIR] drop global phase lock for super types phase
^KT-56551
2023-05-08 14:42:10 +00:00
Dmitrii Gridin 13dc4c8014 [LL FIR] split LLFirLockProvider on read and write API
^KT-56550
2023-05-08 14:42:10 +00:00
Nikolay Lunyak 76df0f9ad1 [FIR] KT-48870: Allow resolution to InaccessibleImplicitReceiverValue
^KT-48870 Fixed
2023-05-08 14:25:54 +00:00
Dmitrii Gridin b9dd2f736a [LL FIR] avoid redundant recursive type resolve for type aliases
In LL FIR we will do this by crawlSupertype

^KT-56550
2023-05-08 12:06:55 +00:00
Dmitrii Gridin 873c7d63ed [LL FIR] avoid redundant pass through the entire super type hierarchy for nested classes
We can omit this step in LL FIR because, according to the contract,
an outer class must be resolved before nested class
Also, it drops unsafe access to superTypeRefs from FIR transformer

^KT-56550
2023-05-08 12:06:55 +00:00
Dmitrii Gridin ee74e10f28 [FIR] avoid jumping from super type transformer for local classes to unresolved non-local classes
In the worst case, we will visit the entire hierarchy of a local class,
where non-local classes are not yet resolved

^KT-56550
2023-05-08 12:06:55 +00:00
Dmitrii Gridin ba08f2c08a [FIR] avoid jumping from status transformer for local classes to unresolved non-local classes
We must resolve a non-local declaration before access
if we want to jump from local to it to avoid possible problems
with parallel resolution

^KT-56550
2023-05-08 08:59:07 +00:00
Kirill Rakhman 7f9118d0f2 [FIR] Resolve property return type before resolving its annotations
This fixes TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM in a declaration
like `@Ann(myConst) const val myConst = ""`.

#KT-58080 Fixed
2023-05-08 07:45:57 +00:00
Mikhail Glukhikh 6ae648f6f6 K2: reproduce KT-58379 2023-05-08 07:43:54 +00:00
Dmitrii Gridin c2b09d3b1e [LL FIR] rewrite LLFirSuperTypeTargetResolver
The previous implementation had issues with
locks, publication and performance

Also, this change fixed a problem with mixed cycle inheritance

^KT-56550
^KTIJ-25430 Fixed
^KTIJ-23520 Fixed
^KT-57623 Fixed
^KTIJ-25372 Fixed
^KT-58357 Fixed
2023-05-05 12:35:46 +00:00
Kirill Rakhman bdf0b41026 [FIR] Consolidate SYNTAX and SYNTAX_WITH_MESSAGE diagnostics 2023-05-05 09:34:23 +00:00
Kirill Rakhman 4c6b6dd700 [FIR] Render error properties and function in FirRenderer 2023-05-05 09:34:23 +00:00
Anna Kozlova 799210262d [decompiler] skip return type check for src functions without return type 2023-05-04 21:31:43 +00:00
Jinseong Jeon 384ed9cc9e AA: regression test for default value that calls previous params 2023-05-04 18:26:32 +02:00
Ilya Kirillov ba3a3915c7 [Analysis API] tests: use tagged caret to find declaration to analyze in the air against
We cannot use a KtFile as analysis context.

^KT-55527
2023-05-04 15:26:50 +00:00
Ilya Kirillov 66de893963 [LL FIR] refactoring: rename LowLevelFirApiFacadeForResolveOnAir.onAirGetTowerContextProvider -> getOnAirGetTowerContextProvider
so it matches its counterpart getOnAirTowerDataContextProviderForTheWholeFile
2023-05-04 15:26:50 +00:00