Commit Graph

3458 Commits

Author SHA1 Message Date
Igor Yakovlev 8102744e00 [Serialization] Fix serialization test data 2023-04-04 11:04:18 +00:00
Igor Yakovlev 81ceb856bb [Serialization] Fix invalid int array creation 2023-04-04 11:04:18 +00:00
Igor Yakovlev 8cb1fca299 [Serialization] Add wasm target platform to serialization plugin 2023-04-04 11:04:17 +00:00
Igor Yakovlev e990c8efd2 [Serialization] Fix invalid ir type for serialize generator 2023-04-04 11:04:17 +00:00
Igor Yakovlev b4d6482581 [Serialization] Fix invalid ir type for deserialize generator 2023-04-04 11:04:17 +00:00
Roman Golyshev 4e0b68b516 [Assign plugin] Use FqName to match annotations in FirAssignAnnotationMatchingService
All other compiler plugins accept "pkg1.pkg2.Class1" classes notation
and correctly match against it

But Assignment plugin used `ClassId` on such qualified names and got
`ClassId("/pkg1.pkg2.Class1")` instead of `ClassId("pkg1/pkg2/Class1")`,
and that lead to unexpected problems

This commit fixes that by using `FqName` instead of `ClassId`

^KT-57406 Fixed
2023-03-31 10:55:05 +00:00
Dmitriy Novozhilov c957a0b43b [IR] Properly serialize IrDeclarationOrigin.GeneratedByPlugin to klibs
^KT-56911 Fixed
2023-03-30 07:52:56 +00:00
Dmitriy Novozhilov 5ccf1eddab [K2 Serialization] Remove obsolete formatting suppression 2023-03-29 15:18:37 +00:00
Dmitriy Novozhilov fb97f4db87 [FIR] Don't create generated nested classifier scope for non-source classes
^KT-57626 Fixed
2023-03-29 15:18:37 +00:00
Pavel Mikhailovskii 85b5a4521e KT-56843 [SLC] Support unsafe property initializers 2023-03-28 08:17:37 +00:00
Dmitriy Novozhilov 62ad784b73 [FIR] Fix matching annotated predicate for java and binary declarations
^KT-57400 Fixed
2023-03-27 10:54:27 +00:00
Dmitriy Novozhilov 336b6ba9f0 [FIR] Extract extension functional type from an annotated functional type during deserialization
^KT-57140 Fixed
2023-03-27 10:44:51 +00:00
Dmitriy Novozhilov 8ca7b32577 [FIR] Register type related extensions in libraries sessions
^KT-57140
2023-03-27 10:44:50 +00:00
Dmitriy Novozhilov 01fc84ee3a [FIR] Add tests for plugins compatibility
^KT-57140
2023-03-27 10:44:50 +00:00
Alexander Udalov 562b27db4e JVM IR: initialize enum entries without invokedynamic
#KT-57316 Fixed
2023-03-24 13:38:32 +00:00
Dmitrii Gridin 706ff6b61f [FIR] pre-resolve some scope callables before creating a scope
In a lot of cases, when we want to process the
declaration in scope, it should be resolved to at least TYPES phase.

To avoid doing it manually in all our variety of scopes, we do it when the scope it created.
It was implicitly working manually before as lazy resolve did a lot of extra work
on resolving a declaration it was not supposed to resolve.
Now it's not the case, and we have to explicitly resolve all the declarations we need.

^KT-56543

Co-authored-by: Ilya Kirillov <ilya.kirillov@jetbrains.com>
2023-03-24 09:57:46 +00:00
Dmitriy Dolovov 2a4d880037 [PL] Deep rework of the partial linkage
1. Leaving no unbound symbols in the IR tree, KT-54491:
   - All unbound symbols are bound to synthetic stub declarations
   - Improved detection of the root cause for every partially linked classifier
   - Improved error messages

2. Visibility valiation, KT-54469

3. Always check deserialized symbols:
   If the deserialized symbol mismatches the symbol kind at the call site in the deserializer then generate and reference another symbol with the same signature. In case PL is off, just throw IrSymbolTypeMismatchException.

4. Handle class inheritance violation:
   - Detect illegal inheritance (ex: inheriting from a final class)
   - Detect invalid constructor delegation (ex: delegating to another class than the direct superclass)
   - Simplification: Reduce the number of PartialLinkageCase subclasses
   - Reworked error message generation to have shorter and clearer messages

5. Handle class transformations and all known side-effects, examples:
   - nested <-> inner
   - class <-> enum/object
   - adding/removing subclasses of sealed class
   - adding/removing enum entries

6. Check direct instantiation of abstract class.
   Such instantiation could be possible if a class was non-abstract in the previous version of a library.

7. Handle unlinked annotations on declarations.
   Such annotations are removed from the IR. The appropriate compiler error message is produced for every individual case.

8. Handle value argument count mismatch at call sites

9. Handle calling suspend function from non-suspend context.
   This could happen if a suspen function was non-suspend in the previous version of a library.

10. Handle overriding inline callables.
    Only the leaf final callable can be marked with `inline`.

11. Detect illegal non-local returns from noinline/crossinline lambdas.
2023-03-23 10:24:27 +00:00
Alexander Udalov 17e4ed8ffc Kapt+JVM_IR: add stub converter test for KT-57388 2023-03-21 22:12:58 +01:00
Ivan Kylchik 2b387e7a10 [FIR LT] Get correct startOffset value for declarations with comments
#KT-56913 Fixed
#KT-56926 Fixed
2023-03-21 16:33:00 +00:00
Leonid Startsev 6ee20574e1 Correctly handle @Repeatable @SerialInfo annotations on classes
that were affected by deduplication of inherited serial info annotations.

Prohibit combination of @InheritableSerialInfo and @Repeatable.

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/2099
2023-03-20 18:15:09 +00:00
Artem Kobzar 7a79de6d16 [K/JS] Move JS IR box tests setup into separated function 2023-03-19 22:53:05 +00:00
Dmitriy Novozhilov 507ef3e951 [FIR] Properly handle declarations from other source sessions in FirPredicateBasedProvider
^KT-57083 Fixed
2023-03-16 15:13:19 +00:00
Leonid Startsev 5cf1c01273 Expand type aliases in K2 when checking if serializable class' properties
have serializers.

#KT-56594 Fixed
#KT-56480 Fixed
2023-03-14 12:11:32 +00:00
Roman Golyshev ff7c095fb3 [FIR][Serialization] Use resolvedCompilerAnnotationsWithClassIds to avoid recursive resolve
`resolvedAnnotationsWithClassIds` requires resolve to TYPES phase,
which is unavailable during compiler plugins stages. Trying to resolve
to that phases will cause an infinite recursive resolve loop

Also, call `resolvedAnnotationsWithArguments` only when
`neededArguments` is true

^KTIJ-24893 Fixed
2023-03-13 17:05:26 +00:00
Alexander Udalov 4f380e876c Deprecate ClassBuilderInterceptorExtension
ClassGeneratorExtension is supposed to be used instead.
2023-03-13 13:54:06 +01:00
Alexander Udalov 163a052f98 Remove old JVM backend implementation of Parcelize
There's no way for the end user to use this implementation anymore,
since old JVM backend cannot be enabled, and nothing else from Kotlin
depends on it.
2023-03-13 13:53:08 +01:00
Alexander Udalov f4b4922a13 Use new ClassGeneratorExtension EP in jvm-abi-gen 2023-03-13 13:53:07 +01:00
Nikolay Krasko 57934a6870 Revert "Revert "[K2/N] KT-57026, KT-57208: Adjust Native & JS test infrastructures for MPP testing""
This reverts commit c0c692844e.
2023-03-10 14:24:49 +01:00
Nikolay Krasko c0c692844e Revert "[K2/N] KT-57026, KT-57208: Adjust Native & JS test infrastructures for MPP testing"
This reverts commit 6964121c15.
2023-03-10 13:14:10 +00:00
Alexander Udalov 9f269b83aa Remove "legacy" mode of jvm-abi-gen plugin
#KT-55375 Fixed
2023-03-10 12:24:50 +00:00
Vladimir Sukharev 6964121c15 [K2/N] KT-57026, KT-57208: Adjust Native & JS test infrastructures for MPP testing
Merge-request: KT-MR-9081
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-03-09 18:56:30 +00:00
Sergej Jaskiewicz e3a4d6fa56 Use star-projected types for building ScriptProvidedPropertyDescriptors
Otherwise, the type parameters of the `kotlin.script.state` property
of type `AggregatedReplStageState` were undefined, which led to
building an ill-formed signature for the script class constructor.
2023-03-03 22:08:57 +00:00
Vyacheslav Gerasimov 499ab48d30 Revert "[Build] Fix compilation of kotlinx-atomicfu-runtime in 1.9.0"
This reverts commit 4ab39b908e.
2023-03-03 15:06:23 +00:00
Andrei Klunnyi 661a2626f3 KT-56632 Script configuration isn't loaded for embedded code snippets
From now on we load script configurations for embedded Kotlin code
snippets. Potentially this might lead to an extra load during a file
analysis.

IDEA side test for the change is here:
`HighlightingTestGenerated.Uncategorized#testKotlinInJavaInjection`

^KT-56632 fixed
2023-03-03 12:49:38 +00:00
Sergey.Shanshin 4e56079c59 [KxSerialization] Fix "SyntheticAccessorLowering should not attempt to modify other files"
Added additional check for generated serializer to use cached child serializers

Fixes #KT-56990

Merge-request: KT-MR-9057
Merged-by: Sergey Shanshin <Sergey.Shanshin@jetbrains.com>
2023-03-02 13:34:48 +00:00
Steven Schäfer 669ac1ae30 Parcelize: Handle nullable sparse arrays
Fixes https://issuetracker.google.com/269956252
2023-03-02 12:47:17 +01:00
Nikolay Lunyak bcfafc601e Add EnumEntries to minimal-stdlib-for-tests
This change allows to revert adding `WITH_STDLIB` directive
to tests which happened at `a9343aeb`.

Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>
2023-03-02 10:23:38 +00:00
Artem Kobzar 50a462fed1 [K/JS] Exclude kotlinx.serialization synthetic declarations from JsExport
^KT-57024 Fixed
2023-02-28 18:11:36 +00:00
Kirill Rakhman 59c61cdd07 [FIR Plugin prototype] Fix AllPropertiesConstructor test
^KT-56861 Fixed
2023-02-28 10:19:19 +00:00
Kirill Rakhman 9dda5e4fcd [Test] Remove redundant FIR_DISABLE_LAZY_RESOLVE_CHECKS directives
KT-56177
2023-02-28 10:19:18 +00:00
Kirill Rakhman c9d68f6d3e [FIR, Parcelize] Fix checkers after primary ctor annotation changes
KT-56177
2023-02-28 10:19:17 +00:00
Kirill Rakhman eee66ab43f [FIR] Remove duplicate annotations from primary ctor params/properties
If an annotation doesn't specify an explicit use-site target,
previously it was added to both, the primary constructor value parameter
and the property in the FIR. Then, in FIR2IR, only the "correct" one was
added to the IR. Move up the deduplication logic into the frontend.

^KT-56177 Fixed
2023-02-28 10:19:17 +00:00
Ilya Muradyan 10e9ef349f Scripts: fix NPE on creating KtFileScriptSource from PSI copy 2023-02-27 13:27:48 +00:00
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