Commit Graph

102973 Commits

Author SHA1 Message Date
Sergej Jaskiewicz b57b4e055e [klib] Move some duplicated code from subclasses to IdSignatureBuilder 2023-07-24 16:40:15 +00:00
Sergej Jaskiewicz ce6e904b70 [klib] Don't forget to set signatures' descriptions before serialization
Ensure that in IdSignatureBuilder hashId/hashIdAcc is only set
together with the description.

In 6142d75bb4 we implemented setting
descriptions when building signatures from descriptors, but forgot to
do the same for building signatures from IR, resulting in missing
descriptions in klibs.

See also: KT-59486
2023-07-24 16:40:14 +00:00
Troels Bjerre Lund 2818957689 [K/N] Custom allocator for all GCs ^KT-55364
Also enables the integration tests for custom allocator and the
currently available GCs.

Co-authored-by: Troels Bjerre Lund <troels@google.com>

Merge-request: KT-MR-11199
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2023-07-24 16:28:47 +00:00
Anastasia.Nekrasova 9864c5c386 Expected type was changed from KtFirNamedClassOrObjectSymbol to KtFirNamedClassOrObjectSymbolBase in getAnnotationApplicableTargets function
Required to support symbols from java file, see KTIJ-26302
2023-07-24 15:17:59 +00:00
Anastasia.Nekrasova 67d8346f5c Added a public function that allows to get the actual annotation target list
The logic to get the actual target is required on the IDE side, see KTIJ-26302
2023-07-24 15:17:59 +00:00
Brian Norman 42ebbb937c [FIR] Recursively search dependsOn modules in visibility checks
#KT-59071 Fixed
2023-07-24 14:20:57 +00:00
Mikhail Glukhikh 95bf63d6cb K2: introduce OptIn language version checker
#KT-60598 Fixed
2023-07-24 12:50:38 +00:00
Mikhail Glukhikh 8c305d6143 K2: introduce infrastructure for LanguageVersionSettings checkers 2023-07-24 12:50:38 +00:00
Pavel Kunyavskiy ba75ee4c03 [K/N] Copy more flags to the first stage of one-shot compilation mode
This fixes obj-export lazy header generation in non-default modes,
and makes nightly tests green.
2023-07-24 12:47:14 +00:00
Mikhail Glukhikh 3547b404d5 Use language version 1.9 in KAPT3 tests to avoid 2.0 migration problems 2023-07-24 12:45:07 +00:00
Roman Efremov cedfdbdc66 Fix test became invalid after KT-59739
^KT-58551
2023-07-24 14:25:26 +02:00
marat.akhin 8eabaff29e [IR] Support IrStarProjection in TypeArgumentMarker.replaceType 2023-07-24 12:15:41 +00:00
marat.akhin a2dda9e25b [IR] Transfer type annotations when substituting via IR substitutor
Other type substitutors (classic, cone-based) respect the type
annotations and copy them to the resulting type for all
cases, including type parameters.

Without this change we cannot correctly match expect/actuals
when we replace actual type parameters with expect ones in case
the actual type parameter has type enhancement annotations
(e.g., `@FlexibleNullability`).

We transfer all annotations (and not conservatively copy only type
enhancement annotations), as 1) other substitutors do that 2) other
IR type substitution utilities (e.g., `IrType.substitute`) do that.
As we will attempt reimplementing all IR type substitution utilities
via IrTypeSubstitutor, it also makes sense to completely align
the behavior.
2023-07-24 12:15:41 +00:00
Ilya Gorbunov 61175889b9 KT-53154 extract implementation of enumEntries into an expect/actual internal helper function
It's required, so it can be implemented in different backends
at a different pace and in a different manner
2023-07-24 11:18:44 +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
Artem Kobzar 53aa8eddfe [K/JS] Generate unstable names on Frontend-checks for declarations with the JsExport.Ignore annotation ^KT-60202 Fixed 2023-07-24 09:52:58 +00:00
Roman Efremov 8ce1417621 [Stdlib] Fix reports of MPP annotation checker
^KT-58551
2023-07-24 09:48:49 +00:00
Roman Efremov 12eb6d97bf [Stdlib] Remove @InlineOnly from expect declarations of minOf(), maxOf()
to satisfy MPP annotation checker.
It has reporting because @InlineOnly is absent on declarations with
Long parameter (removed in 233376eef0).

^KT-58551
2023-07-24 09:48:49 +00:00
Roman Efremov 6611a55a60 [FE] Relax rules of matching @Target annotation on expect and actual
Allow `expect` targets to be subset of `actual`.

^KT-58551
2023-07-24 09:48:49 +00:00
Roman Efremov ad84c83ee9 [FE] Skip more special annotations in KMP annotation matching
Many errors are reported in stdlib with these annotations
(SinceKotlin, Deprecated, so on).
But having them only on expect is a valid case. E.g. SinceKotlin added
if some old platform-specific API becomes commonized.

^KT-58551
2023-07-24 09:48:49 +00:00
Roman Efremov 1dcdcee452 [FE] Add test for intrinsic const evaluation in KMP annotation matching
^KT-58551
2023-07-24 09:48:49 +00:00
Roman Efremov 66824435b5 [FE] Add TODOs for changes for next PR within scope of this issue
^KT-58551
2023-07-24 09:48:49 +00:00
Roman Efremov 234f453173 [FE, IR] Don't check SOURCE annotations if actual declaration has no source
^KT-58551
2023-07-24 09:48:49 +00:00
Roman Efremov 59f1a0dd8e [FIR, IR] Refactor: move annotation retention helper functions
Will be needed in subsequent commit to be accessible in
ExpectActualMatchingContext implementations.

^KT-58551
2023-07-24 09:48:48 +00:00
Roman Efremov 454756a2b5 [IR] Don't check annotations on expect/actual fake overrides
^KT-58551
2023-07-24 09:48:48 +00:00
Roman Efremov 2980179bd7 [IR] Implement IR checker for expect actual annotations matching
^KT-58551
2023-07-24 09:48:48 +00:00
Roman Efremov b6cae1adcc [FE] Allow @OptionalExpectation to be present only on expect
^KT-58551
2023-07-24 09:48:48 +00:00
Roman Efremov 1a4ab9bb4b [FE] Implement FE logic of expect actual annotations matching
This implementation only checks annotations set on expect/actual
declarations and requires further refinement (e.g. checking of other
annotation targets, class scopes within typealiases).

^KT-58551
2023-07-24 09:48:48 +00:00
Roman Efremov b1bdb619d8 [FE] Refactor: provide FirExpectActualMatchingContext as session component
This will be needed in subsequent commits because context must be
accessible from `:fir:checkers` module, but it is in `:fir:resolve`

Intermediate interface `FirExpectActualMatchingContext` is needed
because `FirExpectActualResolver` relies on some FIR-specific methods,
and providing common `ExpectActualMatchingContext` interface is not
enough.

Also in `FirExpectActualMatcherTransformer` context extracted to field
to not create context for each processed element. "session" made
final to calm down warning "accessing non-final property in
constructor".

^KT-58551
2023-07-24 09:48:48 +00:00
Jinseong Jeon 72de540fc9 AA: try finding a module for an associated analysisContext from KtPsiFactory if any 2023-07-24 11:34:51 +02:00
Jinseong Jeon 2dee644f7a AA FE1.0: restore an option to register AnalysisHandlerExtension w/o use-site module 2023-07-24 11:34:51 +02:00
Nikita Bobko 4f3ecedbca [FE] Stop ignoring ABSTRACT_MEMBER_NOT_IMPLEMENTED for expect classes
^KT-59739 Fixed
Review: https://jetbrains.team/p/kt/reviews/11038/timeline
2023-07-24 09:15:11 +00:00
Svyatoslav Scherbina bfcb90c716 Native: add ExperimentalForeignApi opt-in to performance tests
3f3f6eb marks all cinterop-generated declarations with
@ExperimentalForeignApi. As a result, all usages of such declarations
have to opt-in explicitly. This commit adds those opt-ins to all
usages in the performance tests.

^KT-58362
2023-07-24 09:11:58 +00:00
Pavel Kunyavskiy fd564d4af9 [K/N] Disable custom import for forward declarations
If forward declaration exists in a library, it was
possible to import it both by forward declaration name
and normal library name. This is strange unique behavior.
And it would also make KT-59643 changes binary incompatible.
So from now it's only possible to import forward declaration by
forward declaration name only.

^KT-59642
2023-07-24 08:24:20 +00:00
Pavel Kunyavskiy d797505f06 [K/N] Drop merging forward and real declaration in deserializer
^KT-59643
2023-07-24 08:24:20 +00:00
Javier Segovia Córdoba e4c2fa1080 [IR] Improve printing the value parameter when there is an error 2023-07-23 00:16:46 +02:00
Alexander Udalov f7ba1b4a7a IR: minor, improve assertion error message
KT-60502
2023-07-21 20:57:41 +00:00
Shagen Ogandzhanian 9bc9014c26 [KT-59294] Fix for the WRONG_JS_INTEROP_TYPE error in K1WasmJsTranslatorTestGenerated::simpleUndefined 2023-07-21 19:13:58 +00:00
Shagen Ogandzhanian eb7805baf9 [KT-59294] [wasm] Resolve undefined to null for any nullable types in external functions 2023-07-21 19:13:57 +00:00
Svyatoslav Scherbina ef6dcd9779 Native, K2: add ExperimentalForeignApi to generated forward declarations
cinterop tool should add ExperimentalForeignApi to all generated
declarations, to indicate their experimental status and discourage using
them in public Kotlin API. But the same considerations are applicable
to forward declarations (cnames.*, objcnames.*), which are generated not
by cinterop tool, but directly by the compiler.

This commit adds ExperimentalForeignApi to those compiler-generated
classes.

^KT-58362
2023-07-21 17:44:09 +00:00
Svyatoslav Scherbina cba955cb3e Native, K1: add ExperimentalForeignApi to generated forward declarations
cinterop tool should add ExperimentalForeignApi to all generated
declarations, to indicate their experimental status and discourage using
them in public Kotlin API. But the same considerations are applicable
to forward declarations (cnames.*, objcnames.*), which are generated not
by cinterop tool, but directly by the compiler.

This commit adds ExperimentalForeignApi to those compiler-generated
classes.

^KT-58362
2023-07-21 17:44:09 +00:00
Zalim Bashorov d6ba233bbe Define fail in the test to pass on JVM and Native 2023-07-21 17:27:17 +00:00
Zalim Bashorov b1a4d354f1 Regenerate tests 2023-07-21 17:27:17 +00:00
Zalim Bashorov 5d1379ead1 [Wasm] Optimize when using br_table only if all conditions read and compare the same variable
#KT-60212 Fixed
2023-07-21 17:27:16 +00:00
Svyatoslav Scherbina 39ef189e05 Native: change GCC toolchain for linux_arm32_hfp
^KT-58864
2023-07-21 16:13:26 +00:00
Svyatoslav Scherbina a30b1c6cc1 Native: remove a few headers from linux_arm32_hfp linux platform lib
Those are not available in the new GCC toolchain.

^KT-58864
2023-07-21 16:13:26 +00:00
Svyatoslav Scherbina 682c105230 Native: remove unused headers.x86-64 from linux.def
`headers.x86-64` property in a cinterop .def file is not actually used
by cinterop. `headers.x64` should be used instead.

This commit removes it completely instead of renaming -- no functional
changes are done.
2023-07-21 16:13:25 +00:00
Alexander Udalov 1cd24c61b8 Build: suppress warnings in kotlin-gradle-plugin
There's a lot of warnings which are distracting during each build.

 #KT-60498 Fixed
2023-07-21 15:33:09 +00:00
mvicsokolova 298c4f8c32 [K/N] Introduce atomic arrays in K/N stdlib
This commit introduces API for AtomicIntArray, AtomicLongArray and AtomicArray<T>.

The current set of functions is implemented via atomic arrays intrinsics (see KT-58360) and provides sequentially consistent memory ordering guarantees and no spurious failures in compareAndSet/compareAndExchange operations.

For details see: KT-60608

Merge-request: KT-MR-11071
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-07-21 15:30:20 +00:00
Alexander Udalov ebd43fc8c0 Tests: minor, improve tests on $EntriesMappings classes
These tests were initially testing that $EntriesMappings classes were
correctly generated, but started to check something else once the
language feature EnumEntries was enabled by default.
2023-07-21 14:55:22 +00:00