Commit Graph

3415 Commits

Author SHA1 Message Date
Ilya Kirillov ce3305300b [FIR] temporary mute blackbox test which fails on runtime
It was failing before, but it was hidden as the actual test was not run due to the bug in the test pipeline.

In the case of any WrappedException.FromHandler were thrown, no blackbox tests were run.

Tracking issue: ^KT-56861
2023-02-24 16:11:45 +01:00
Ilya Kirillov 69c024a5ce [FIR] optimize deprecation calculation for symbols
All symbols except member callables can be deprecated if they have non-empty annotation list

^KT-56800 fixed
2023-02-24 16:10:57 +01:00
Dmitriy Novozhilov 8ff330079e [Assign plugin] Remove experimentality warning
The plugin is still experimental, see
  https://kotlinlang.org/docs/components-stability.html

^KT-56925 Fixed
2023-02-24 11:19:45 +00:00
Dmitriy Novozhilov da581f38e1 [Test] Require specifying parser for FIR test. Unify names for FIR tests
Now all tests with `Fir` in name are named accordingly to parser which
  is used in them -- `FirPsi` or `FirLightTree`. This is needed to keep
  consistency between different types of tests, because there is no
  single default in parser mode between different scenarios of using FIR
2023-02-24 11:15:26 +00:00
Sergey.Shanshin 63025030e3 [KxSerialization] Fix SERIALIZER_NOT_FOUND diagnostic for enums
Fixes #KT-56738

Merge-request: KT-MR-8938
Merged-by: Sergey Shanshin <Sergey.Shanshin@jetbrains.com>
2023-02-22 19:38:18 +00:00
Dmitriy Novozhilov e5b4cf9f04 [Test] Update serialization tests according to KT-56755 2023-02-20 08:40:34 +00:00
Dmitriy Novozhilov 25b1fbc541 [Build] Pin api and language level to 1.8 in :pill:pill-importer module
^KT-56687
2023-02-18 13:26:54 +00:00
Dmitriy Novozhilov 4ab39b908e [Build] Fix compilation of kotlinx-atomicfu-runtime in 1.9.0
^KT-56400
2023-02-18 13:26:53 +00:00
Dmitriy Novozhilov 8ccd7c7d12 [FIR] Create context and scope for incremental compilation separately
Scope for incremental compilation refers to binaries from previous step
  of IC. It is used not only in IC context itself, but also it is
  subtracted from original libraries scope. Before previous commit there
  was such scheme:
1. create incremental compilation context for files of specific session
2. subtract IC scope from main libraries scope
3. use updated libraries scope to create library session
4. create all needed source session(s)

So here was a side effect of creating new IC context, which
1. is smelling code, because it increases mind complexity
2. hard to implement with new session utilities

So to fix this problem this commit changes the scheme above:
1. create IC scope and modify libraries scope
2. create libraries session
3. create source session(s) and IC context for them
2023-02-17 11:08:51 +00:00
Dmitriy Novozhilov 79e4df72bf [CLI] Introduce utilities for creating FirSession hierarchy in CLI for all platforms
Also support session creation and compilation for HMPP projects

^KT-56209 Fixed
2023-02-17 11:08:51 +00:00
Dmitriy Novozhilov d4bb740a62 [CLI] Store information about HMPP module for source files 2023-02-17 11:08:50 +00:00
Leonid Startsev c564dd973b Add declarations from serialization plugin to FIR metadata declarations provider.
These declarations should not be visible to users (and therefore are not added to FIR),
but plugin itself can reference them in already compiled serializable classes,
and therefore they should be available in metadata:

- synthetic deserialization constructor
- static write$Self function

See also:
^KT-55885
2023-02-16 15:36:18 +00:00
Leonid Startsev 5cd817955b Actualize README.md for kotlinx-serialization plugin 2023-02-15 13:39:58 +00:00
Sergey.Shanshin 498c1abbc6 [KxSerialization] Fix SERIALIZER_NOT_FOUND diagnostic for enums
If enum class from dependencies is used, which was compiled by a new version of the plugin, which uses a factory and does not create a nested `$serializer` class, then an `SERIALIZER_NOT_FOUND` diagnostic error is thrown for such an enumeration.
This happens if the old serialization runtime is used for the current project - in this case, the serializer is taken from the nested class `$serializer`. Since it is missing, the diagnostics does not work correctly.
It is acceptable for enumerations to ignore this error, because we know that enumerations are always serializable.

Merge-request: KT-MR-8818
Merged-by: Sergey Shanshin <Sergey.Shanshin@jetbrains.com>
2023-02-14 22:10:30 +00:00
Sergey.Shanshin c9b8160f1e [kxSerialization] Added diagnostic on useless Serializer annotation
Resolves Kotlin/kotlinx.serialization#2182

Merge-request: KT-MR-8718
Merged-by: Sergey Shanshin <Sergey.Shanshin@jetbrains.com>
2023-02-14 22:00:33 +00:00
Leonid Startsev 80ad6a4cd7 Support plugin intrinsics for serializer() function in K2.
- Add IrPluginContext to JvmBackendContext, so plugin intrinsics can
reference external functions properly.

- Do not use module.findClassAcrossModuleDependencies as Descriptor API does not work for FIR.

- Add asm listing tests in serialization plugin for K2

- Remove Delegated.kt asm listing test as we have similar test in boxIr group.

#KT-56553 Fixed
2023-02-14 13:43:09 +00:00
Nikolay Lunyak a9343aeb7d [FIR] KT-55840: Ensure everything actually works
This inconsistency is present due to not using the `// WITH_STDLIB`
in the above tests. When K1 creates the enum, it tries to generate
`entries()`, and for that it tries to load `kotlin.enums.EnumEntries`,
but this is actually an unresolved reference. K1 silently swallows it,
and proceeds.

The reason K2 doesn't fail is that in order to generate `entries()` it
simply creates the necessary `ConeClassLikeType` with the desired
`classId` instead of loading the whole `ClassDescriptor`.

The reason we can still observe `$ENTRIES` and `$entries` in K1
is because they are generated during the JVM codegen, and it
only checks if the `EnumEntries` language feature is supported. It
doesn't check if the `entries` property has really existed in IR
(by this time it's expected to have already been lowered to the
`get-entries` function - that's why "has ... existed").

The reason why the codegen doesn't fail when working with
`kotlin.enums.EnumEntries` is because it creates its
own `IrClassSymbol`.

^KT-55840 Fixed

Merge-request: KT-MR-8727
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2023-02-10 16:57:51 +00:00
Dmitriy Novozhilov 41192b022d [FIR] Pass context to all relevant methods of FirDeclarationGenerationExtension
^KT-53470 Fixed
2023-02-10 12:30:14 +00:00
Dmitriy Novozhilov ea73cde5fb [Lombok] Make visibility of fields of @Value classes private by default (K2)
^KT-51092 Fixed
2023-02-10 12:30:13 +00:00
Dmitriy Novozhilov 0550f0d394 [Lombok] Make visibility of fields of @Value classes private by default (K1)
^KT-51092
2023-02-10 12:30:12 +00:00
Pavel Mikhailovskii 4c7f8ba196 KT-56457 Annotate Enum.entries with @NotNull 2023-02-09 20:13:56 +00:00
Dmitriy Novozhilov a197d1aadc [FIR Plugin prototype] Add simple implementation of FirDeclarationsForMetadataProviderExtension
^KT-55885
2023-02-08 08:44:51 +00:00
Leonid Startsev e0dce31cde Support situation when argument for serializer<T>() function has SerialInfo annotations.
Because SerializationJvmIrIntrinsicSupport does not instantiate annotations yet,
this info could be lost. As a workaround, it is possible to call Companion.serializer()
functions instead of direct serializer instantiation, as they are plugin-generated
and correctly handle annotations.

Note that for some cases (enums & interfaces) this WA is not enough, so additional work
is needed later.

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/2179
2023-02-07 16:41:01 +00:00
Alexander Udalov 1844869e8a Kapt+JVM_IR: fix ordering of properties in generated stubs
Apparently it depended on the ordering of the synthetic `$annotations`
methods generated for properties. And those methods were always
generated at the end of a Java stub by kapt because they lacked PSI
element, and thus `ClassFileToSourceStubConverter.convertClass` could
not compute their source position, and it placed them at the end as all
other synthetic methods.

The solution is to provide PSI element for `$annotations` methods in
JvmDeclarationOrigin. This origin is then collected in kapt in
`OriginCollectingClassBuilderFactory` and used for sorting, as in the
case of the old JVM backend.

 #KT-56360 Fixed
2023-02-06 21:34:10 +00:00
Dmitriy Novozhilov 791a7b1c31 [FIR] Extract function type kind for lambda in argument position
^KT-56381 Fixed
2023-02-06 10:08:37 +00:00
Valeriy.Vyrva 9a0e2b08f1 Bump JUnit5 version to 5.9.1 2023-02-06 10:01:52 +00:00
mvicsokolova bc612fa1c6 Atomicfu-plugin (JVM IR): fix visibility of wrapper classes generated for static atomics.
Fixes https://github.com/Kotlin/kotlinx-atomicfu/issues/272
2023-02-02 16:37:06 +00:00
Alexander Udalov 94f1c579df Kapt+JVM_IR: do not generate SuspendFunction supertypes
#KT-54380 Fixed
2023-02-02 15:01:43 +00:00
Dmitriy Novozhilov 89c42e20c9 [FIR] Consistently use _function_ instead of _functional_ in names of classes and functions 2023-02-02 08:24:52 +00:00
Dmitriy Novozhilov f268ab8858 [FIR plugin prototype] Implement Composable-like extension 2023-02-02 08:24:52 +00:00
Dmitriy Novozhilov d1b797ed97 [FIR] Generify resolution and inference of arguments of functional types 2023-02-02 08:24:50 +00:00
Dmitriy Novozhilov c86495dcae [FIR] Introduce ConeFunctionalTypeKind as a replacement of FunctionClassKind
This is needed to provide an ability to extend different kinds of
  functional types

Also, cleanup and rename utilities related to functional types to avoid
  possible confusions
2023-02-02 08:24:49 +00:00
Dmitriy Novozhilov 125b773205 [FIR] Introduce utility for creating ConeClassLikeLookupTagImpl from ClassId
`classId.toLookupTag()` looks much cleaner than `ConeClassLikeLookupTagImpl(classId)`
2023-02-02 08:24:48 +00:00
Anna Kozlova 48b1456290 [CLI] create ArgumentParseErrors instances on request
spare memory for projects with big number of modules
currently 500kb for IJ monorepo of mostly empty errors
2023-01-31 16:08:23 +00:00
Alexander Udalov 2849e45111 Kapt tests: change _ir.txt to .ir.txt
To be consistent with test data of other compiler tests.
2023-01-31 13:49:44 +00:00
Kirill Rakhman 63a908cff8 FIR, Assign plugin: Update for KT-54648 2023-01-31 08:39:43 +00:00
Dmitriy Novozhilov 36bb418049 [Parcelize] Add test for KT-47074 2023-01-31 07:53:08 +00:00
Leonid Startsev 26330133ab Support intrinsifying of serializer() function when it is seen inside multifile class part
It's needed to be able to correctly compile kotlinx-serialization-core itself,
as compiler sees real function, not one from a facade.

#KT-56244 Fixed
2023-01-30 10:49:46 +00:00
Dmitriy Novozhilov 88efa6bfb6 Update tests after switching to LV 1.9 2023-01-30 09:29:57 +00:00
Alexander Udalov 4b0d878873 Change KaptFlag.USE_JVM_IR default value to true
According to the comment on `Kapt3GradleSubplugin.BooleanOption` and the
change in a7b1bade85.

 #KT-53135
2023-01-26 12:07:19 +00:00
Alexander Udalov ef208d9eac Throw if kotlinx-metadata-jvm version in jvm-abi-gen is too low 2023-01-25 23:24:05 +01:00
Ivan Kochurkin 5f1ed56554 [FIR] Extract createFirLibraryListAndSession to cliCompilerUtils
Use it in compilerPipeline and FirKotlinToJvmBytecodeCompiler
2023-01-24 15:27:13 +00:00
Ivan Kochurkin c103da98dd [FIR] Add missing dependencies to :compiler:fir:checkers:checkers.native 2023-01-24 15:27:12 +00:00
Nikolay Krasko 4f69f61ef7 Advance version of kotlinx serialization in imports-dumper
File separator are not escaped now, as there's no need to escape /
character in JSON strings.
2023-01-21 16:38:48 +00:00
Sergej Jaskiewicz 1f76d39e66 [IR] Make IrTypeArgument a sealed interface 2023-01-20 10:58:28 +00:00
Ilya Goncharov d7c31f79a8 Do not suppress NPM related tasks, but be aware about checking of them in task graph 2023-01-19 13:43:57 +00:00
Leonid Startsev dc0cd61b6f Handle @Serializable classes that implement interfaces by delegation
by filtering out delegated properties that end up in irClass.properties() list

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/2157
2023-01-19 11:12:31 +00:00
Sergey.Shanshin d063db3ce0 Fixed missing fallback serializer in contextual serializer
Fixes Kotlin/kotlinx.serialization#2158

Merge-request: KT-MR-8338
Merged-by: Sergey Shanshin <Sergey.Shanshin@jetbrains.com>
2023-01-18 15:47:26 +00:00
Alexander Likhachev 87db928b2d [IC] Support precise output backup for jvm-abi-gen plugin
#KT-49785 In Progress
2023-01-17 22:15:53 +00:00
Alexander Likhachev 4c2923f96f [IC] Support precise output backup for kapt stubs
#KT-49785 In Progress
2023-01-17 22:15:53 +00:00