Commit Graph

3813 Commits

Author SHA1 Message Date
Nikolay Krasko 58fd558308 Remove flaky Kapt4ToolIntegrationTestGenerated test
The test is now very flaky and leads to java.lang.OutOfMemoryError

KTI-1559
2024-01-19 14:01:02 +00:00
Artem Kobzar 7568ee5a79 [K/JS] Add VOID optimization on object properties + align with the optimization the JS Plain Object plugin 2024-01-19 13:03:06 +00:00
Kirill Rakhman d74b5c59fb [kapt] Fix new compilation warnings after #KT-63208
(cherry picked from commit 9b4ebc31c1)
2024-01-18 08:27:10 +00:00
Artem Olkov 37a8723a79 KT-64931: add convertion of kotlin top-lvl functions into swift static functions
Merge-request: KT-MR-13878
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2024-01-17 20:30:04 +00:00
Rafał Galczak c7d4a7e1f1 Add support for serializing kotlin.time.Duration in Parcelize plugin.
This commit adds support for the Parcelize plugin to generate default
serialization implementation for the kotlin.time.Duration. As Parcelize
already supports serializing some of the kotlin library types it makes
sense to support more common ones for the user convenience.

https://issuetracker.google.com/issues/264614661
2024-01-17 11:24:26 +00:00
Artem Kobzar dfe2d8651e [K/JS] Prepare JS Plain Objects plugin to publication 2024-01-17 10:52:58 +00:00
Sergey.Shanshin 96d7dc4fa6 [KxSerialization] Fixed access private custom serializer on property
When a custom serializer is specified on a type and this type is used in a property of another serializable class, then on the JVM this leads to an error accessing the custom serializer class - because it is private and located in another package.

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/2495


Merge-request: KT-MR-12877
Merged-by: Sergei Shanshin <Sergey.Shanshin@jetbrains.com>
2024-01-16 20:04:17 +00:00
Vladimir Tagakov ad9c100137 Sort class members in jvm-abi-gen
#KT-64589 Fixed
2024-01-16 20:03:29 +00:00
Alexander Udalov 1a46b053f2 jvm-abi-gen: minor, refactor debug info and body removing visitors
Co-authored-by: Vladimir Tagakov <vtagakov@lyft.com>
2024-01-16 20:03:29 +00:00
Brian Norman eded51a0f5 [Parcelize] Detect redundant TypeParceler when type aliases are used
Make sure redundancies between class and property TypeParceler
annotations are detected when a type alias is used. This requires
checking the expanded type arguments of the annotation, as just
comparing the cone types is not sufficient because the type arguments
are not expanded.

^KT-64979 Fixed
2024-01-16 13:58:48 +00:00
Brian Norman 20340f94d4 [Parcelize] WriteWith Parceler type argument must be subtype of property
K2 checks that the entire Parceler of the WriteWith annotation is a
subtype of the expected Parceler for the property, while K1 only checks
that the type argument of the WriteWith Parceler is a subtype of the
property type. This mismatch leads to inconsistencies between K1 and K2
diagnostic reporting. Switch K2 to K1 behavior so diagnostics are
consistent.

^KT-60019 Fixed
2024-01-16 13:58:48 +00:00
Artem Olkov baa0748375 KT-64932: add support for no-package top level functions
Merge-request: KT-MR-13879
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2024-01-16 10:58:51 +00:00
Vladimir Sukharev 07938205bc [FIR][K/N] Get rid of SymbolInternals in FirObjCInterop 2024-01-16 09:39:16 +00:00
Sergej Jaskiewicz ad9f7bf90e [IR] Don't use the GET_PROPERTY origin on IrGetField expressions.
This origin was set somewhat arbitrarily.
It actually only makes sense for `IrCall`s to property getters.
There were no places in lowerings that checked `IrGetField` expressions
for this origin value.

^KT-62500 Fixed
2024-01-16 09:26:27 +00:00
Kirill Rakhman 77f83ce816 Revert "[kapt] Fix new compilation warnings after #KT-63208"
This reverts commit 9b4ebc31c1.
2024-01-16 09:14:18 +01:00
Sergej Jaskiewicz 2e6b7a3856 [atomicfu] Don't create Volatile's constructor for each call site
^KT-64971 Fixed
2024-01-15 17:28:22 +00:00
Kirill Rakhman 9b4ebc31c1 [kapt] Fix new compilation warnings after #KT-63208 2024-01-15 12:23:27 +00:00
strangepleasures 0dd3abba2a [KAPT] Support type annotations in K2 KAPT. Fixes KT-64479 2024-01-15 10:24:38 +00:00
strangepleasures 7e9d6e601d KT-64385 Enable K2 KAPT by default
Also adds support for front-end compiler plugins in Kapt
2024-01-15 10:22:32 +00:00
Sergey Bogolepov 591e98a947 [KT-63275] Generate wrapper bodies in the SwiftExportExtension 2024-01-12 15:06:18 +00:00
Sergey Bogolepov d54877be87 [KT-63275] Prepare SirAsSwiftSourcesPrinter for non-empty bodies 2024-01-12 15:06:18 +00:00
Brian Norman be728d4291 [Lombok] Constructor can have only non-static fields
When using the AllArgsConstructor annotation (directly or via
meta-annotation), only fields that are not static should be added as
arguments. Previously, all fields were being included regardless of
static-ness, which is not consistent with the behavior of Lombok.

^KT-54025 Fixed
2024-01-12 14:55:24 +00:00
Brian Norman 2ab1e712f8 [Lombok] Constructor can have only non-final or not initialized fields
When using the AllArgsConstructor annotation (directly or via
meta-annotation), only fields that are not final or not initialized
should be added as arguments. Previously, all fields were being included
regardless of modality or initialization, which is not consistent with
the behavior of Lombok.

^KT-54054 Fixed
2024-01-12 14:55:24 +00:00
Nikolay Lunyak f7f5ac080f [FIR JS] Create an LT Box runner 2024-01-12 13:42:23 +00:00
Yan Zhulanow e67042118a [Pill] Use the multi-platform kotlin-test library (see KT-61969)
Pill import broke after the 'kotlin-test' build refactoring
(now it's a proper KMP project). This change adapts source set handling
in Pill, providing support both for Java and Kotlin KMP source sets.
2024-01-11 16:44:59 +00:00
Dmitriy Novozhilov dbbfb23fa9 [Build] Fix JPS build issue caused by :plugins:jso module 2024-01-11 12:48:34 +00:00
Artem Kobzar 300702a7e7 [K/JS] Create JavaScript Simple Object plugin that helps create typed JS objects 2024-01-10 16:30:02 +00:00
Leonid Startsev fba2f5ea4e Expand most kotlinx.serialization tests on JS backend
to enhance and increase test coverage of the plugin.
2024-01-10 12:17:34 +00:00
Vladimir Sukharev e166e70916 [FIR] Refactor FirRegularClassSymbol.getSuperClassSymbolOrAny
^KT-61564
2024-01-09 14:17:47 +00:00
strangepleasures 894df8f641 KT-64719 K2 KAPT stub generation should fail on syntax errors 2024-01-05 15:58:41 +00:00
Dmitrii Gridin b6d373d8e5 Update copyright to 2024 2024-01-05 13:43:17 +00:00
Leonid Startsev 7700921646 Add K2 configurations for specific kotlinx.serialization tests
#KT-64447 Fixed
2024-01-05 11:38:35 +00:00
Dmitriy Novozhilov c2cbbecfe9 [K2 Serialization] Store serializable properties in metadata extension
This solution is temporary (see KT-64694 for details)

^KT-64312 Fixed
2024-01-05 11:30:57 +00:00
Dmitriy Novozhilov 7accda6cda [FIR] Make FirProviderWithGeneratedFiles know about providers from mpp dependencies
During refactoring of FIR2IR commit 8ebb4127 introduced
  `FirProviderWithGeneratedFiles` for lookups for containing FIR for
  generated declaration

But it broke the logic of `Fir2IrIrGeneratedDeclarationsRegistrar`,
  which provides annotations for metadata from generated IR annotations
  (see `containingFile` function in it), as it started to use fir
  provider from the platfrom session instead of provider of the
  corresponding session

So to fix this issue `FirProviderWithGeneratedFiles` was changed in the
  way so it sees declarations from dependant sessions too (only with
  `dependsOn` relation), which allows to use provider for the leaf
  platform session for declarations from any module within the same
  HMPP hierarchy

^KT-64444 Fixed
2024-01-05 09:42:22 +00:00
Brian Norman 9ec469e3c3 [Parcel] Expand types from TypeParceler annotation to support aliases
Class properties are being expanded before checking for custom
parcelers, which makes custom parcelers of type alias unable to be
found. To maintain K1 behavior, the custom parceler type must also be
expanded, so even the aliased type is supported when used in its raw
form as a class property.

^KT-64707 Fixed
2024-01-04 19:59:56 +00:00
Alexander Udalov ee8d42532b Fir2Ir, JVM IR: support flexible Array types loaded from Java
We don't have true flexible types in the IR, but we approximate it with
internal type annotations, such as FlexibleNullability,
FlexibleMutability, RawType. These annotations are then handled
specially in JvmIrTypeSystemContext, which can construct a fake flexible
type so that type checker on IR types would behave exactly as on
frontend types.

As shown in KT-63441, one instance of flexible types where flexibility
was lost during conversion to IR is Java array/vararg types. It's
necessary to support it so that IR fake overrides could be constructed
correctly, because IR fake override checker requires parameter types to
be equal. So this change introduces another internal type annotation,
FlexibleArrayElementVariance, which is only applicable to types with
classifier kotlin/Array, and which signifies that the annotated type
`Array<X>` should rather be seen as `Array<X>..Array<out X>`.

 #KT-63441 Fixed
 #KT-63446 Fixed
2024-01-04 15:54:27 +00:00
Alexander Udalov a9f85d75f4 Kapt: remove support for old JVM backend
#KT-64680 Fixed
2024-01-03 19:37:40 +00:00
Alexander Udalov c251eb19a6 Kapt: remove old JVM backend test data (2/2)
In this commit, .ir.txt expectation test data files for the JVM IR
backend are renamed to .txt. This is done as two separate commits so
that Git would recognize that these files were logically moved, not that
the contents of the original .txt files were changed.

 #KT-64680
2024-01-03 19:37:40 +00:00
Alexander Udalov 9c67616b25 Kapt: remove old JVM backend test data (1/2)
In this commit, .txt expectation test data files for the old JVM backend
are deleted.

 #KT-64680
2024-01-03 19:37:40 +00:00
Alexander Udalov e4a608c6e7 Kapt: remove tests on old JVM backend
#KT-64680
2024-01-03 19:37:40 +00:00
Dmitriy Novozhilov 56221467ff [FIR] Rename PLUGIN_ANNOTATION_AMBIGUITY to COMPILER_REQUIRED_ANNOTATION_AMBIGUITY
This diagnostic may be reported even without any compiler plugins (e.g.
  for annotation named `Target` or `Deprecated`), so the old name
  and message were quite confusing

^KT-64654
2024-01-03 08:50:20 +00:00
Sonya Valchuk 588549d1d0 JVM_IR: add offsets to JvmStatic and JvmOverloads proxies
KAPT3 needs them to correct error types in arguments.

 #KT-64639 Fixed
2024-01-02 17:43:09 +00:00
Mads Ager e41a1247e2 JVM_IR: Generate more line numbers for intrinsic comparisons.
Otherwise, if complex expressions such as when expressions are
used in combination with the intrinsics we get incorrect stepping
behavior.

^KT-64341 Fixed
2023-12-20 15:39:03 +00:00
Leonid Startsev 6c6f2ccacd Handle non-reified type parameters of function inside serializer<T>() intrinsic
to match an error message thrown from KType-based serializer<T>().

Fixes https://github.com/Kotlin/kotlinx.serialization/issues/2528
2023-12-20 13:50:39 +00:00
Sergej Jaskiewicz 1b557c1657 [IR] Mark IrExpressionBodyImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
Sergej Jaskiewicz 2096d22e18 [IR] Mark IrBlockBodyImpl with an opt-in annotation
KT-59318
2023-12-19 16:20:02 +00:00
strangepleasures b32f408767 [KAPT] KT-64389 Fix stub generation with generic type constraints 2023-12-19 13:33:38 +00:00
Marco Pennekamp 3497809ebd [Test] Add missing disposal for test root disposables
^KT-64099
2023-12-19 11:12:23 +00:00
Marco Pennekamp 32fe29b8cc [Test] Add debug names to unnamed test disposables
- This helps to track down disposables which are never disposed, and
  reduces confusion when printing disposables in general (the names will
  now be meaningful, instead of endless lists of "newDisposable" and
  "TestDisposable").

^KT-64099
2023-12-19 11:12:23 +00:00
Marco Pennekamp bba5447b12 [Test/AA] Pass project disposable to getOrCreateApplicationEnvironment instead of application disposable
- The disposable passed to `getOrCreateApplicationEnvironment` should
  not actually be the application environment's disposable, which is
  created inside the function. Instead, it should be the project's
  disposable, which is used to track how many projects still rely on the
  shared application environment.
- This issue wasn't apparent before because there is no visible
  consequence when an application isn't disposed after all projects have
  been disposed (during tests). However, the solution for KT-63650
  relies on application environments being disposed after all projects
  are disposed, so that a new application environment with a different
  configuration can be created. (Only one shared application environment
  may be active at the same time.)

^KT-63650
2023-12-19 11:12:23 +00:00