Commit Graph

100448 Commits

Author SHA1 Message Date
Dmitrii Gridin 8387ea8a39 [LL FIR] FileStructure: process annotations from constructors correctly
^KT-56543
2023-04-19 20:12:43 +00:00
Dmitrii Gridin 71f48ede53 [LL FIR] resolve compiler required annotations correctly
Original AbstractFirSpecificAnnotationResolveTransformer can jump
to other classes and resolve them outside
our transformers, so it leads to
problems with locks and lazy bodies

^KT-56543
2023-04-19 20:12:42 +00:00
Dmitrii Gridin 22b5d940f1 [FIR] move lazy expression assertions to more common class
^KT-56543
2023-04-19 20:12:42 +00:00
Dmitrii Gridin efdae98ba8 [FIR] SignatureEnhancement: reduce access to initializer field
It can trigger lazy calculation of FirJavaField initializer

^KT-56543
2023-04-19 20:12:41 +00:00
Dmitrii Gridin 6170d83301 [FIR] update reversed testData
^KT-56543
2023-04-19 20:12:41 +00:00
Dmitrii Gridin 1c5aa6c45b [FIR] add reversed testData to update it in the next commit
^KT-56543
2023-04-19 20:12:41 +00:00
Ilya Kirillov cc52e896f9 [FIR] ensure that status is resolved when we create fake overrides
We should create the fake override only when we
already have resolved status.

Otherwise, the fake override declaration will be created
with unresolved status, and its status will never be computed
as we do not resolve fake override declarations.

^KT-56543
2023-04-19 20:12:40 +00:00
Dmitrii Gridin 7c8f7bdbfb [FIR] FirDelegatedMemberScope: add missing resolve
^KT-56543
2023-04-19 20:12:40 +00:00
Dmitrii Gridin 26f8147a8c [LL FIR] FileStructure: process super class calls correctly
^KT-56543
^KT-57793
2023-04-19 20:12:39 +00:00
Dmitrii Gridin d0e801054c [FIR] builder: add test on class with wrong super call
^KT-56543
^KT-57793
2023-04-19 20:12:39 +00:00
Dmitrii Gridin 332cdc514b [LL FIR] reanalyse declarations on the air for incremental analysis
We cannot do it inplace now as we do not have a lock to do
it under after analysis started to use declaration-level lock

This part is mostly covered by the plugin tests
(which failed after the previous commit)

^KT-56543
2023-04-19 20:12:39 +00:00
Dmitrii Gridin 72def186a3 [LL FIR] rework transformers, so transformers resolve only a specific set of declarations
The change is needed for the parallel resolution (^KT-55750), so we can resolve the declaration
under a lock that is specific to this declaration.
Previously, if LL FIR was resolving some FirClass, LL FIR  resolved all its children too, and it had no control over what parts of the FIR tree were modified.
The same applied to the designation path, sometimes the classes on the designation path
might be unexpectedly (and without lock) modified.

This commit introduces LLFirResolveTarget, which specifies which exact declarations should be resolved during the lazy resolution of the declaration.
All elements outside the declarations specified for resolve in LLFirResolveTarget, should not be modified.

The logic of lazy transformers is the following:
- Go to target declaration collecting all scopes from the file and containing classes
- Resolve only declarations that are specified by the LLFirResolveTarget, performing the resolve under a separate lock for each declaration

^KT-56543
^KT-57619 Fixed
2023-04-19 20:12:38 +00:00
Dmitrii Gridin 18a8cfb090 [AA FIR] firSymbolUtils: avoid redundant resolve
^KT-56543
2023-04-19 20:12:36 +00:00
Dmitrii Gridin 093695962a [FIR] hacky fix lazy resolve contract violation for deprecation of enum entries
Enum entries can be used as types in Kotlin (even it's a compilation error)
To use the classifier as a type, we need to find if it's hidden or not.
The deprecations for classes are calculated on COMPILER_REQUIRED_ANNOTATION phase, and that's okay as it goes before the TYPES phase.
For enum entries, the deprecations are calculated on TYPES phase which goes on TYPES phase.
This is incorrect as we cannot jump from lower phase to upper phase

The hack ignores such deprecation search for enum entires.

Test: org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.Tests.testEnumEntryAsType

^KT-57648
^KT-56543
2023-04-19 20:12:36 +00:00
Dmitrii Gridin 7e380e7df5 [LL FIR] remove LLFirPhaseRunner as it does nothing
^KT-56543
2023-04-19 20:12:36 +00:00
Dmitrii Gridin 72fce82f2f [LL FIR] remove useless checks for resolve phases inside transformers
Those checks are not performed during locking

^KT-56543
2023-04-19 20:12:35 +00:00
Dmitrii Gridin 0f379e592a [LL FIR] make LLFirLazyTransformerExecutor an object
^KT-56543
2023-04-19 20:12:35 +00:00
Dmitrii Gridin a172439f2a [LL FIR] move update declaration resolve phase out of updatePhaseForDeclarationInternals
needed for further safe publication of phase update

^KT-56543
2023-04-19 20:12:35 +00:00
Dmitrii Gridin d52c8b6793 [LL FIR] move updateDeclarationInternalsPhase checks out of LLFirLazyTransformer
needed for further safe publication of phase update

^KT-56543
2023-04-19 20:12:34 +00:00
Dmitrii Gridin e686e840b0 [LL FIR] move checkIsResolved checks out of LLFirLazyTransformer
needed for further safe publication of phase update

^KT-56543
2023-04-19 20:12:34 +00:00
Ilya Kirillov 930708ebb0 [LL FIR] lazy resolve imports under a separate lock
^KT-56543
2023-04-19 20:12:34 +00:00
Abduqodiri Qurbonzoda c1fb6528aa [WASM] Introduce internal ExperimentalNativeApi
To be able to OptIn usages in shared native-wasm directory.
2023-04-19 19:02:14 +00:00
Abduqodiri Qurbonzoda b6c2ce2dc8 [K/N] Make assert functions experimental with ExperimentalNativeApi 2023-04-19 19:02:14 +00:00
Abduqodiri Qurbonzoda 245ef256bd [K/N] Mark Throwable.getStackTrace[Addresses] with ExperimentalNativeApi
As a part of efforts to stabilize Native stdlib #KT-55765.
2023-04-19 19:01:36 +00:00
Abduqodiri Qurbonzoda 2140580fb1 [K/N] Mark Any?.identityHashCode() with ExperimentalNativeApi
Instead of ExperimentalStdlibApi

As a part of efforts to stabilize Native stdlib #KT-55765.
2023-04-19 19:01:36 +00:00
Dmitriy Novozhilov 92ab82b2f3 [Test] Remove duplicating testdata files 2023-04-19 18:41:21 +00:00
Anna Kozlova 04eb02085a [psi] bump stub version
missed from f810d435f4
2023-04-19 19:09:00 +02:00
Simon Ogorodnik ecf40e5c7a Revert "KT-57927: Fix deserialization of K2JVMCompilerArguments in FP/MT tests"
This reverts commit f8fdfc5d332b171b0e9e410b09a0b1e30d0d510e.

The change should be reverted as original change of the format in the
K2JVMCompilerArguments was reverted by commit:
5d0bf2de24

Merge-request: KT-MR-9684
Merged-by: Simon Ogorodnik <Simon.Ogorodnik@gmail.com>
2023-04-19 16:30:11 +00:00
Leonid Startsev f29e505bd3 Use correct check in FirSerializationPluginClassChecker to determine if the given type is a enum class.
Otherwise, findTypeSerializerOrContextUnchecked works incorrectly when analyzing code
compiled with Kotlin 1.7.20 and serialization 1.4.1.

#KT-57704 Fixed
2023-04-19 16:13:28 +00:00
Ilya Kirillov 167ed5e049 [Analysis API] add a KDoc for the LLFirSymbolProviderNameCache 2023-04-19 16:09:07 +00:00
Ilya Kirillov 806fff0887 [Analysis API] forbid Analysis inside KtResolveExtensionProvider
As it's called during FIR sessions initialization

^KT-57930
2023-04-19 16:09:06 +00:00
Ilya Kirillov 0d0b1b7945 [Analysis API] add ability for a custom element navigation for a KtResolveExtensionFile
^KT-57930
2023-04-19 16:09:05 +00:00
Ilya Kirillov 51eaa3f9cf [Analysis API] provide tests for the KtResolveExtensionProvider
^KT-57930
2023-04-19 16:09:05 +00:00
Ilya Kirillov d68587de77 [Analysis API] implement API to extend Kotlin resolution by generated declarations
^KT-57930 fixed
2023-04-19 16:09:04 +00:00
Ilya Kirillov 0dbc948616 [LL FIR] introduce CompositeKotlinDeclarationProvider
^KT-57930
2023-04-19 16:09:01 +00:00
Ilya Kirillov 9ca99ba7c7 [LL FIR] introduce CompositeKotlinPackageProvider
^KT-57930
2023-04-19 16:09:00 +00:00
Ilya Kirillov 9dcc9d0d10 [LL FIR] introduce LLFirCompositeSymbolProviderNameCache
^KT-57930
2023-04-19 16:09:00 +00: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
Ilya Kirillov 3b681cd2eb [LL FIR] extract base class from LLFirSymbolProviderNameCache
^KT-57930
2023-04-19 16:08:59 +00:00
Nikolay Lunyak c9d7b47900 [FIR] Report == for identity-less
Since we forbid overriding `equals` for
value classes, and value classes may only
implement interfaces, we know everything
about their `equals`, hence we can
guarantee if it always returns `false`
for different value classes.
2023-04-19 16:05:19 +00:00
Nikolay Lunyak 8d04ab3142 [FIR] Ignore nullability in the definition of "identity-less"
The definition of a "builtin" already
ignores nullability.

`Int? === String?` must trigger a
diagnostic by design.
2023-04-19 16:05:19 +00:00
Nikolay Lunyak 5ecedcbb16 [FIR] Ensure K2 doesn't report Int? === String? 2023-04-19 16:05:18 +00:00
Alexander Korepanov 898ed7658a [JS IR] Update list of config settings affecting IC invalidation 2023-04-19 15:43:22 +00:00
Denis.Zharkov 4e2107abe7 K2: Fix false positive NotImplemented error for size property
The problem appeared because not all of the `realOverridden` have been
collected because inside AbstractSerializableListDecorator some of the
scopes returned the same instance as direct overridden and after that
overridden tree traversal stopped without detecting real overrides.

Thus, the modality of intersection for
AbstractSerializableListDecorator::size and MutableSet::size
was incorrectly computed to ABSTRACT

The similar thing is already done at the place where we're obtaining
all overrides.
See https://github.com/JetBrains/kotlin/commit/c80cfb0fdb00323ba9b5e1dd98c5cbd0bfab6b8b#diff-182d90c9b8050557e4e2eb319a84b9a51fd0600c728dd0fce85cf6491c13e16dR152

^KT-57693 Fixed
2023-04-19 15:20:49 +00:00
Dmitriy Novozhilov 6544220b3e [FIR] Check only for visibility modifiers for NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED error
^KT-58033 Fixed
2023-04-19 14:53:42 +00:00
Nikita Bobko 8314812ef9 2/2 FirUnsupportedSyntheticCallableReferenceChecker: don't report error on FirJavaOverriddenSyntheticPropertySymbol
Meta issue: KT-8575
^KT-58061 Fixed
Review: https://jetbrains.team/p/kt/reviews/9677

This commit fixes an inconsistency between
FirUnsupportedSyntheticCallableReferenceChecker and
UnsupportedSyntheticCallableReferenceChecker

In K1 such properties were not considered synthetic and are called
JavaPropertyDescriptor. That's why we need to do an additional check in
K2 checker, while in K1 we didn't need to do it

Also see the previous commit for more related tests that already was
green without this fix but are related to KT-58061 problem
2023-04-19 14:33:45 +00:00
Nikita Bobko 11f376ae84 1/2 Covert FirUnsupportedSyntheticCallableReferenceChecker with more tests
Review: https://jetbrains.team/p/kt/reviews/9677

I'm going to fix KT-58061 in the next commit. Firstly, let's cover
FirUnsupportedSyntheticCallableReferenceChecker with more tests that
already pass, but are related to KT-58061 problem.
2023-04-19 14:33:45 +00:00
Dmitriy Novozhilov 6287968511 [FIR Test] Migrate AbstractFirLoadCompiledKotlin to new test infrastructure
Also introduce two different modes for those tests:
- load metadata compiled with K1
- load metadata compiled with K2
2023-04-19 14:33:25 +00:00
Dmitriy Novozhilov 63829876b7 [Test] Add empty new line at the end of dump in MultiModuleInfoDumper if needed 2023-04-19 14:33:25 +00:00
Dmitriy Novozhilov e94a64a4f2 [FE Test] Move FIR dumps for LoadCompiledKotlin tests close to original testdata 2023-04-19 14:33:24 +00:00