Commit Graph

3338 Commits

Author SHA1 Message Date
Alexander.Likhachev 95fd91ae16 [CLI, Gradle] Update GradleDeprecatedOption.removeAfter values
The values updated to follow the deprecation cycle "warning -> error -> removed"
^KT-65986 In Progress
2024-02-27 13:07:18 +00:00
Alexander.Likhachev d20f31e963 [CLI, Gradle] Fix GradleDeprecatedOption.removeAfter processing
The expected format was Kotlin language version (e.g. `2.0`), however the actual passed values were Kotlin release versions (e.g. `2.0.0`)
^KT-65986 In Progress
2024-02-27 13:07:18 +00:00
Nikita Nazarov 407448d8e3 [JVM] Implement new inlined variable naming format
^KT-65478 fixed
2024-02-23 23:59:13 +01:00
Alexander Udalov 0b10d3a0e9 Minor, move JavaModuleResolver from frontend.java to frontend.common.jvm
To be reused in the K2 checker (KT-60797).
2024-02-21 14:10:44 +00:00
Ilya Chernikov 10dbe73828 K2 Scripting: report error on attempt to use scripts in common roots
#KT-65967 fixed
2024-02-21 07:47:15 +00:00
Ilya Chernikov e5a6900458 K2 scripting: separate scripts compilation into another session
when scripts are compiled along with other sources.
#KT-65865 fixed
2024-02-21 07:47:15 +00:00
Dmitrii Gridin 072d191306 [compiler] replace Enum values() with entries
To fix warnings. Also, use of `Enum.entries` may improve the performance

^KT-48872
2024-02-20 17:56:46 +00:00
Alexander Udalov 90ff8f0e64 JVM: support -Xjdk-release=7/1.7
#KT-59098 Fixed
2024-02-19 11:44:58 +00:00
Alexander Udalov 12f393791b JVM: allow -jvm-target 1.8 with -Xjdk-release=1.6
#KT-59098
2024-02-19 11:44:58 +00:00
Alexander Udalov 1bc08fc5b8 JVM: report error on -Xjdk-release=6 without -jvm-target
#KT-59098
2024-02-19 11:44:58 +00:00
Ilya Goncharov 12cd9c4530 [Gradle, JS] Deprecate only deprecated properties in compiler arguments copy 2024-02-09 18:20:08 +00:00
Ilya Goncharov d02be30e3b [Gradle, JS] Return back deprecated options noStdlib and metaInfo 2024-02-09 18:20:08 +00:00
Ilya Goncharov 2340d59f40 [JS] Get rid of outputFile in compiler args (KT-61116)
^KT-56753 fixed
2024-02-09 18:20:08 +00:00
Pavel Mikhailovskii 7ab9e03347 KT-65684: KAPT: (Re)enable fallback to K1 KAPT and make it default
[KAPT] KT-65684 Set languageVersion=1.9 in KaptToolIntegrationTestGenerated

[KAPT] KT-65684 Re-enable a few now-passing tests in Kapt4IT

[KAPT] KT-65684 Fix the logic setting -Xuse-kapt4 flag in Kapt4IT.forceKapt4()

The change is needed to make sure that all the tests have the flag set,
 otherwise some of them would silently switch to the fallback node.
Also disables a few now failing tests.

[KAPT] KT-65684 Revert "KT-64385 Enable K2 KAPT by default"

This reverts commit 7e9d6e60


Merge-request: KT-MR-14291
Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
2024-02-09 12:54:28 +00:00
Roman Efremov 1f30d076de [CLI] Introduce compiler argument to suppress error about API version
...greater than language version.

^KT-63712
2024-02-09 11:02:26 +00:00
Evgeniy.Zhelenskiy 7eab4b672d [K1, K2, CLI] Mark whole position range of compiler diagnostics in CLI
#KT-64989
2024-02-08 12:59:31 +00:00
Alexander Udalov 28797a31b4 JVM: refactor JvmDefaultMode, remove/rename some entries
- remove ENABLE/COMPATIBILITY because they can no longer be used
- remove forAllMethodsWithBody because its behavior is now equivalent to
  isEnabled
- inline isCompatibility
- inline DEFAULT
- rename ALL_INCOMPATIBLE -> ALL
2024-02-06 17:18:44 +00:00
Evgeniy.Zhelenskiy f05c972efb [K2, CLI] Support endOffset in Kotlin CLI
Duplicated messages in testdata appeared because default renderer
renders diagnostic spans ambiguously. It shows only start position.
In fact, there are 3 failures, 2 of them distinguish only by the
diagnostic end offset. See youtrack for more information.

The issue about inconvenient rendering is KT-64989.

#KT-64608
2024-02-05 13:26:13 +00:00
Alexander Udalov 77dba281a3 CLI: remove obsolete -Xbuiltins-from-sources
Looks like it has no effect anymore after 3f2e996803.
2024-02-01 23:37:23 +00:00
Alexander Udalov 2d308e7c27 CLI: remove obsolete language feature arguments
These arguments switch language features which cannot be disabled
anymore because they're enabled from some LV not later than 1.4, and the
minimal supported LV is currently 1.4.
2024-02-01 23:37:23 +00:00
Alexander Udalov c2e67619ba CLI: remove obsolete -Xdisable-ultra-light-classes 2024-02-01 23:37:23 +00:00
Alexander Udalov 9d5e1bdc47 CLI: remove obsolete -Xallow-result-return-type 2024-02-01 23:37:23 +00:00
Alexander Udalov 49c659b379 CLI: remove obsolete -Xdump-declarations-to
It was only used in the very old version of binary compatibility
validator. It was never supported in the JVM IR backend.
2024-02-01 23:37:23 +00:00
Sergej Jaskiewicz f39335b3f7 [klib] Don't pass around metadata serialization closure
Pass the metadata serializer instance instead. This allows to further
reduce code duplication by introducing the common interface
`KlibSingleFileMetadataSerializer` for abstracting away K1 and K2
representation of a source file, as well as reusing
`Fir2KlibMetadataSerializer` across different backends.

KT-64392
2024-01-29 21:07:43 +00:00
Sergej Jaskiewicz 93a1ceae75 [klib] Deduplicate KLIB serialization logic in K/JS and K/N
Introduce the new `serializeModuleIntoKlib` function that all KLIB-based
backends can use to serialize a module to a KLIB.

^KT-64392 Fixed
2024-01-29 21:07:43 +00:00
Sergej Jaskiewicz c335cd0b1e [IR] Remove unused IrMessageLogger from serialization logic 2024-01-29 21:07:43 +00:00
strangepleasures 4c8b5c699e [KAPT] [CLI] KT-65251 Run Kapt CLI with -Xmx512M by default 2024-01-29 15:47:36 +00:00
Dmitriy Novozhilov ed874262e3 [FIR] Part 3. Setup running platform checkers in CLI
^KT-58881
2024-01-24 10:45:00 +02:00
Marco Pennekamp dcf7b84082 [Test] Reset ApplicationManager.application when shared application environments are disposed
- Shared application environments can be disposed in the middle of test
  plan execution when the project count reaches zero. So resetting
  `ApplicationManager` only on "test plan execution finished" is
  incorrect, because it does not account for that scenario. Instead, we
  should reset `ApplicationManager` every time the application
  environment is disposed.
- We should also keep the manual reset in `testPlanExecutionFinished`
  because `disposeApplicationEnvironment` may not need to dispose
  anything if there isn't a shared application environment, but we
  should still reset `ApplicationManager` if an unshared application
  environment was created.
- This fixes "Some test disposed, but forgot to clear MockApplication"
  exceptions which appeared after KT-64099 because it opened up proper
  disposal of the shared application environment (instead of it being in
  a state of leakage because not all project disposables were properly
  disposed).

^KT-63650
^KT-64099
2024-01-23 21:52:31 +00:00
Sergej Jaskiewicz bc5810ee67 [FIR2IR] Don't use descriptor manglers in FIR2IR
They don't do anything, only complicate the initial configuration.

KT-64990
2024-01-19 13:36:00 +00:00
Sergej Jaskiewicz 8b4cc050eb [FIR2IR] Remove linkViaSignatures from Fir2IrConfiguration
^KT-64809 Fixed
2024-01-19 13:36:00 +00:00
Sergej Jaskiewicz e8aa05928d [FIR2IR] Unconditionally disable linkViaSignatures on JVM
It was an experimental compilation mode that we don't need anymore.

KT-64809
2024-01-19 13:35:59 +00:00
Dmitriy Novozhilov 0741250b12 [FIR] Use proper FirProvider in the FirKLibSerializerExtension
3aa84906 changed native metadata serialization to use proper platform
  session, but it caused a new bug: FirKLibSerializerExtension uses
  FirProvider from the passed session to get a containing file of
  serialized declaration to put some extension into the metadata. And
  platform session doesn't contain information about any declarations
  except platform ones

So it's needed to use the proper FirProvider in it, which can be
  extracted from Fir2IrComponents. This provider contains providers from
  all sessions that are being compiled plus providers for top-level
  declarations generated by compiler plugins

^KT-65024 Fixed
2024-01-17 17:38:44 +00:00
Artem Kobzar a55c65e3e2 [K/Wasm] Add simple TypeScript definitions generating ^KT-65009 Fixed 2024-01-16 11:10:27 +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
Sergej Jaskiewicz a0ba878b1d [FIR2IR] De-duplicate creation of Fir2IrConfiguration
This will help to prevent inconsistencies between creating
the configuration in the actual compiler pipeline and in compiler tests.
2024-01-11 12:16:54 +00:00
Alexander.Likhachev 60080e8bb8 [Build] Remove redundant trove4j compileOnly dependencies
^KTI-1135 In Progress
2024-01-10 11:29:25 +00:00
Alexander.Likhachev 21b438f55d Replace the trove4j collections usages with the fastutil ones
The trove4j library is licensed under LGPL, and that causes some troubles while working with it. The fastutil library provides the same functionality in the context of our needs, and is licensed under the Apache license.
^KTI-1135 In Progress
2024-01-10 11:29:25 +00:00
Dmitriy Dolovov e92017f64e [KLIB Resolver] Deprecate Logger.fatal()
Invocation of Logger.fatal() may cause severe side effects such as
throwing an exception or even terminating the current JVM process
(check various implementations of this function for details).

The code that uses Logger.fatal() sometimes expects a particular kind
of side effect. This is totally a design flaw. And it's definitely not
a responsibility of Logger to influence the execution flow of
the program.
2024-01-08 13:26:24 +00:00
Pavel Kunyavskiy f45d92eebc [K/N, K/JS, K/WASM] Enable FakeOverrideRebuilder by default
While not beeing final solution, this is closer to what
we want to have in the end. Enabling on non-JVM targets
would help better testing.

Enabling in JVM is now not possible yet, as some of the bugs are
not fixed yet (check KT-61360 for details)

^KT-62476
2024-01-08 07:46:07 +00:00
Alexander Shabalin 3f2584bb02 [K/N] Move calls checker into separate module ^KT-62091 2024-01-05 13:35:35 +00:00
Dmitriy Novozhilov 8ff869a08c [FIR] Unregister FirJavaElementFinder at the Project disposing
^KT-64433 Fixed
2024-01-05 10:23:04 +00:00
Troels Bjerre Lund b668433256 [CLI] Add cache for reflection lookup of CLI arguments
Add cache for reflection lookup of CLI arguments.

Replace CLI argument list with map.

The current cli parser tries to match every possible command line
argument against each command line argument, essentially in a double
loop. This fix replaces one of the loops with a map lookup. Building the 
map is not expensive, and pays for itself even with a modest number of
parameters. The map is cached between calls, making subsequent calls
much cheaper. If run in a daemon, repeatedly parsing, e.g., 250 
arguments, this speeds up argument parsing by a factor 20. 

Disallow -shortName=value in CLI arguments.

Co-authored-by: Troels Lund <troels@google.com>
2023-12-19 17:05:03 +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
Artem Kobzar 2530cba82a [K/JS] Compile Kotlin coroutines as JS generator ^KT-63038 Fixed 2023-12-18 17:13:07 +00:00
Dmitriy Dolovov b1093d8082 [KLIB Resolver] Don't discriminate KLIBs by duplicated unique_name in K2 metadata compiler
Use the same approach as in K1 metadata compiler: resolve each library
separately from others, don't attempt to resolve them all at once.

^KT-63573
2023-12-18 13:03:40 +00:00
Dmitriy Dolovov 46081f968d [KLIB Resolver] Report KLIB resolver issues as compiler messages
The reason of this change is to make messages (especially warnings)
that are reported by the KLIB resolver become visible to the end user.
This can be achieved to forwarding such messages to the appropriate
compiler's components such as
`org.jetbrains.kotlin.cli.common.messages.MessageCollector` and
`org.jetbrains.kotlin.ir.util.IrMessageLogger`.

Also: The default `DummyLogger` should be used as minimal as possible.
Because it just forwards messages to the standard output (console)
where they can remain unattended. When the compiler is executed
from the Gradle plugin such messages appear only in DEBUG Gradle's log.

^KT-63573
2023-12-18 13:03:40 +00:00
Dmitriy Novozhilov f4e3203cd8 [FIR] Unregister java element finders from previous sessions
The problem here is that for common session we register `FirJavaElementFinder`
  which provides light classes based on expect classes. And then
  at the start of analysis of jvm module we register one another
  `FirJavaElementFinder`, which sees actual classes and uses them to
  build light classes

But, because class ids of expect and actual class pair are the same and
  element finders are ordered by creation order, when java resolve tries
  to resolve some class, it founds light class based on expect class,
  even if we are already in platform session

To fix this problem, it was decided to unregister all previous element
  finders on creation of each new session, so old finders won't interfere
  with analysis

^KT-63612 Fixed
^KT-64296
2023-12-14 09:51:15 +00:00
Ivan Kochurkin 145958e284 [K2] Disable constants evaluation with native metadata compilation
^KT-63835 Fixed
2023-12-08 16:38:04 +00:00