Commit Graph

3794 Commits

Author SHA1 Message Date
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
Brian Norman 645970fa7a [Parcelize] Fix subclass check of deprecated Parceler interface
^KT-59949 Fixed
^KT-60090 Fixed
2023-12-14 16:36:07 +00:00
strangepleasures 7b841d90e6 [KAPT] KT-64303 Dispose resources allocated by Standalone Analysis API; re-enable Kapt4IT
Merge-request: KT-MR-13510
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2023-12-14 14:10:14 +00:00
Artem Olkov cae6e0ee0f Add checks that kotlin-native.swift-export.enabled is actually turned on
Merge-request: KT-MR-13506
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2023-12-14 10:27:19 +00:00
Vladimir Sukharev ec3dd43edc [Tests] Enforce FIR_IDENTICAL for Fir tests with IrTextDumpHandler
^KT-64256 Fixed
2023-12-13 22:39:45 +00:00
strangepleasures 1015ae858e [KAPT] KT-64301 Report invalid enum value names
Merge-request: KT-MR-13520
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2023-12-13 17:53:52 +00:00
strangepleasures b84aa190d7 [KAPT] KT-64297 Mark deprecated members with @java.lang.Deprecated
Merge-request: KT-MR-13521
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2023-12-13 17:18:54 +00:00
Ilya Gorbunov d2aae67e03 Replace kotlin-test project dependencies in the project
Use dependency helper function that chooses whether to take them
from the bootstrap repository or from a configuration of kotlin-test

KT-61969
2023-12-13 15:40:25 +00:00
Sergey Bogolepov 01976990e8 [Swift Export] Use ExportedBridge instead of ExportForCppRuntime
ExportedBridge annotation actually does what we need in Swift Export.
Unlike ExportForCppRuntime, it prevents symbol from DCE.
2023-12-13 14:09:58 +00:00
Artem Olkov 5fcdd4a9f6 KT-63748: Pack Swift Export Frontend into compiler plugin
Co-authored-by: Sergej Jaskiewicz <jaskiewiczs@icloud.com>


Merge-request: KT-MR-13351
Merged-by: Artem Olkov <artem.olkov@jetbrains.com>
2023-12-13 10:40:38 +00:00
Sergej Jaskiewicz f844a86057 [utils] Introduce the bind function and use it throughout 2023-12-13 10:04:45 +00:00
Ilya Chernikov eeb723eb01 K2 Scripting: wrap script statements into blocks
(reuse anonymous initializers as block wrappers) so the top-level script
elements are all declarations now. Rename the property accordingly (
together with the previous commit).
It makes script more similar to the class and thus simplify e.g.
control flow analysis and resolve code.
2023-12-12 09:58:19 +00:00
Ilya Chernikov c9aee5bf09 minor: rename FirScript.statements do declarations...
to simplify the following commit that actually convert the types
and wrap statements into blocks.
2023-12-12 09:58:19 +00:00
Ilya Chernikov b0f44e8f69 K2 Scripting: mark parameters and DD containers with dedicated origins
needed for properly processing script CFG
2023-12-12 09:58:19 +00:00
Leonid Startsev a03fd2e29a Make visibilities of writeSelf and deserialization constructor in FIR
same as they were in K1 (see KSerializerDescriptorResolver): internal for
final classes and public for non-final.

Unfortunately, there are no Klib API dumps tests in the compiler, so I tested manually.

#KT-64124 Fixed
2023-12-12 09:02:14 +00:00
Yan Zhulanow c499095382 [Pill] Fix importing after ideaHomePathForTests() signature change
Before, the 'File' was returned. Now, it's 'Provider<Directory>'.
2023-12-11 19:31:57 +00:00
Brian Norman dc198be0ad Merge branch 'bnorm/kotlin-power-assert' 2023-12-08 08:46:35 -06:00
Alexander Udalov fe1e2b8b34 jvm-abi-gen: Support removeDebugInfo option
This option removes debug info, such as:
- SourceFile attribute on classes
- LocalVariableTable, LineNumberTable, SourceDebugExtension attributes
  on inline functions
- @SourceDebugExtension annotation on inline functions

 #KT-33020 Fixed
2023-12-07 20:50:01 +00:00
Alexander.Likhachev a19bd2ed2e [Build] Migrate most of the build logic from Project.buildDir usage
It's going to be deprecated in Gradle 8.3

There's currently no way to pass a `org.gradle.api.provider.Provider` to the JavaExec.systemProperty or Test.systemProperty. There's a workaround using `org.gradle.process.CommandLineArgumentProvider`, but I intentionally don't rework these calls as Gradle is going to allow passing providers to configure system properties: https://github.com/gradle/gradle/issues/12247#issuecomment-1568427242
^KTI-1473 In Progress
2023-12-07 18:31:06 +00:00
Andrei Klunnyi 0a57c661fd Comment for LazyScriptDefinitionProvider's property
Relates to KTIJ-27951.
2023-12-07 16:37:35 +00:00