Commit Graph

2391 Commits

Author SHA1 Message Date
Pavel Mikhailovskii 1f649b698c [CLI] Get rid of unnecessary type parameters in arguments.kt 2023-04-21 13:21:28 +00:00
Roman Golyshev d4cffb8a5a [213] Switch to 213 platform
KTI-1114
2023-04-21 13:19:04 +00:00
Pavel Mikhailovskii 58143a2006 KT-57598 Run Kapt with K1 even when the compiler is run with K2 2023-04-20 09:30:38 +00:00
Ivan Kylchik 0b70b7904d [K2] Create and add EvaluatedConstTracker in configuration 2023-04-19 13:52:43 +00:00
Ivan Kylchik fe989d0ba7 [K2] Add languageVersionSettings to Fir2IrConfiguration class 2023-04-19 13:52:42 +00:00
Ivan Kylchik e16231104e [K2] Add Fir2IrConfiguration class to store configuration parameters
One example of such parameter is `linkViaSignatures`. There is
`Psi2IrConfiguration` as an analog for K1.
2023-04-19 13:52:41 +00:00
Sebastian Sellmair 5d0bf2de24 [CLI] Restore K2JVMCompilerArguments.classpath and javaModulePath
to support IDEs < 2023.2

Reverts:
- 9dcd40d7b7
- fb66764c4d

KTIJ-25227
2023-04-18 09:18:10 +00:00
Ivan Kochurkin 3a60b30dae Minor: IrActualizationResult -> IrActualizedResult 2023-04-17 19:55:35 +00:00
Nikita Bobko 9ca7ee3b97 Don't forget to configure JdkHome for CompilerConfiguration
Review: https://jetbrains.team/p/kt/reviews/9562

This commit fixes IdeaJsr223Test in kotlin plugin. The test failure was
caused by b50a803b6f commit where we
dropped `put(JVMConfigurationKeys.JDK_HOME, ...)` from
`configureJdkClasspathRoots`. Ilya Chernikov says that it's incorrect to
set JDK_HOME in `configureJdkClasspathRoots`.

To reproduce the test failure:
1. Update `.idea/libraries/kotlinc_kotlin_dist.xml` and
   `.idea/libraries/kotlinc_kotlin_jps_plugin_classpath.xml` with new
   Kotlin (in other words: bump bundled JPS)
2. Run the test

Test failure stacktrace:
```
javax.script.ScriptException: error: cannot access 'java.io.Serializable' which is a supertype of 'kotlin.Int'. Check your module classpath for missing or conflicting dependencies
y.first() + 2
          ^
  at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.asJsr223EvalResult(KotlinJsr223JvmScriptEngineBase.kt:104)
  at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.compileAndEval(KotlinJsr223JvmScriptEngineBase.kt:63)
  at org.jetbrains.kotlin.cli.common.repl.KotlinJsr223JvmScriptEngineBase.eval(KotlinJsr223JvmScriptEngineBase.kt:31)
  at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:262)
  at org.jetbrains.kotlin.idea.repl.IdeaJsr223Test.testJsr223Engine(IdeaJsr223Test.kt:31)
  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.base/java.lang.reflect.Method.invoke(Method.java:568)
  at junit.framework.TestCase.runTest(TestCase.java:177)
  at com.intellij.testFramework.UsefulTestCase.lambda$runBare$11(UsefulTestCase.java:479)
  at com.intellij.testFramework.UsefulTestCase.lambda$wrapTestRunnable$13(UsefulTestCase.java:500)
```
2023-04-12 13:16:10 +00:00
Sebastian Sellmair fb66764c4d [CLI] K2JVMCompilerArguments: Model modulePath as Array<String>
to allow interning individual file-path arguments on the IDE

KTIJ-24976
2023-04-06 16:03:04 +00:00
Sebastian Sellmair 9dcd40d7b7 [CLI] K2JVMCompilerArguments: Model classpath as Array<String>
to allow interning individual file-path arguments on the IDE

KTIJ-24976
2023-04-06 16:03:03 +00:00
Dmitriy Novozhilov 92a59279d5 [FIR] Properly implement serializer extension for klib compilation
^KT-57654 Fixed
2023-04-05 07:31:33 +00:00
Ivan Kylchik 32297c0f21 Serialize and deserialize const val's properly for K2 klib
#KT-57312 Fixed
2023-04-04 12:35:54 +00:00
Dmitriy Novozhilov 96e9d690a6 [CLI] Prohibit passing HMPP module structure with CLI arguments to metadata compiler
^KT-57644 Fixed
2023-03-31 09:59:52 +00:00
Dmitriy Novozhilov b9c61bbc60 [FIR] Properly setup dependant module data for metadata compilation
^KT-57377 Fixed
2023-03-31 09:59:51 +00:00
Vladimir Sukharev b9633375b4 [K2/N] KT-56030: Support Objective-C overloading by param names only
Merge-request: KT-MR-8901
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-03-30 09:37:57 +00:00
Dmitriy Novozhilov 8ca7b32577 [FIR] Register type related extensions in libraries sessions
^KT-57140
2023-03-27 10:44:50 +00:00
Ivan Kylchik 5d5582d201 Move ignoreConstOptimizationErrors compiler key from jvm to common
#KT-56023
2023-03-24 15:55:03 +00:00
Ivan Kochurkin ee73e4774b [K2, MPP] Remove redundant expect declarations from klib metadata
^KT-57250 Fixed

Introduce flat Fir2IrActualizedResult

It contains output from Fir2Ir and IrActualizer
2023-03-24 14:48:26 +00:00
Ilya Chernikov 59b88f33b2 [K2, MPP] implement IR errors reporting and test infrastructure
Fix test data

^KT-56344 Fixed
2023-03-22 01:28:16 +00:00
Dmitriy Novozhilov b6a41c6d93 [CLI] Extract classes of compiler configuration from :compiler:cli to the separate module
Those classes mainly include KotlinCoreEnvironment and its dependencies

This change is needed for two reasons:
1. Splitting of some common configuration of compiler from logic of CLI
    makes code structure more clean
2. There is a need to add dependency on `:analysis:analysis-api-standalone`
    to `:compiler:cli`, because FIR analogue of AnalysysHandlerExtension uses
    services from it. But the problems is that standalone AA itself depends
    on classes for compiler configuration, which leads to circular
    dependency between those modules. Extracting configuration to
    `:compiler:cli-base` solves the problem
2023-03-16 15:16:32 +00:00
Alexander Korepanov e3402fcc87 [K2 JS] Do not load transitive dependencies for building K2/JS klibs
^KT-57262 Fixed
2023-03-15 10:49:54 +00:00
Ivan Kylchik 1c210822ea Add new configuration key that can enable IR inlining for JVM 2023-03-14 20:47:41 +00:00
Alexander Udalov 4f380e876c Deprecate ClassBuilderInterceptorExtension
ClassGeneratorExtension is supposed to be used instead.
2023-03-13 13:54:06 +01:00
Alexander Udalov fba5b96bef JVM IR: introduce ClassGeneratorExtension
This is a low-level extension point for Kotlin/JVM, which is supposed to
be used instead of ClassBuilderInterceptorExtension.

 #KT-54758 Fixed
 #KT-56814 Fixed
2023-03-13 13:51:52 +01:00
Alexander Udalov b1d109e7a3 JVM IR: do not use JvmDeclarationOrigin in duplicate signatures
Apparently the client code which reports errors only meaningfully uses
the `descriptor` field of `JvmDeclarationOrigin` in case of JVM IR.
2023-03-13 13:51:52 +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
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
Ilya Chernikov 54218eb77d FIR LT: fix column calculation with crlf line endings
#KT-57117 fixed
also:
- refactor the position finder (mostly for testability)
- add testing of position finder to the testLightTreeReadLineEndings
- refactor the test for readability
- add mixed line ending scenario
2023-03-08 10:18:05 +00:00
Ivan Kochurkin de5b475f7a [FIR] Use KlibBasedSymbolProvider in FirCommonSessionFactory
Unify logic of KLib resolving (Common and JS)

^KT-56354 Fixed
2023-03-03 20:58:24 +00:00
Ivan Kochurkin d829f8b684 [FIR] Drop using of JavaSymbolProvider and OptionalAnnotationClassesProvider in FirCommonSessionFactory
Drop using of all Java stuff inside FirCommonSessionFactory

^KT-56063
2023-03-03 20:58:24 +00:00
Sebastian Sellmair b90207edb9 [Gradle] Rename -Xdepends-on to -Xfragment-refines and use ':' for -Xfragment-sources instead of ';'
^KT-56210 Verification Pending
2023-03-01 16:30:44 +00:00
Sebastian Sellmair 21bf497830 [CLI] Replace K2 -Xmodule by -Xfragments and -Xfragment-sources
KT-56210
2023-03-01 16:30:41 +00:00
Dmitriy Novozhilov e0fa1e64b9 [FIR] Properly setup java parser version for CLI pipeline with light tree
^KT-56549 Fixed
2023-02-28 09:17:41 +00:00
Ilya Chernikov cecf22e035 Fix application environment keepalive handling
The previous changes to the disposer registration changes introduced a
weird problem exposed in the Gradle (test?) environment, that caused
a performance regression - it seems that keep alive system property
in that setting was cleared at the time the disposer was called, causing
app env disposal when keeping it alive was expected.
This fix captures property value at the moment of disposer registration,
making it similar in that respect to the previous variant and avoiding
the performance degradation.
#KT-56992 fixed
2023-02-28 08:08:09 +00:00
Svyatoslav Kuzmich 54a45c49f8 [Wasm] Add Wasm platform and K1 FE infrastructure 2023-02-24 01:05:23 +01:00
Simon Ogorodnik 253cdb1b8f KT-56789: Fix memory leak in CoreJrtFileSystem
CoreJrtFileSystem uses JrtFileSystemProvider provider to read contents
of jrt-fs from JDK
Implementation of FileSystems.newFileSystem causes metaspace memory leak
that wasn't fixed until JDK 17, see
https://bugs.openjdk.java.net/browse/JDK-8260621

When FileSystems.newFileSystem used to create jrt-fs on JDK9 with
provided java.home value it creates new ClassLoader under-the-hood,
which subsequently leaks due to aforementioned bug

Remove conditional usage of `java.home` + FileSystems.newFileSystem and
switch to use jrt-fs classloader cache regardless of
compiler runtime JDK to reduce classloader leaks

^KT-56789
2023-02-23 15:55:24 +00:00
Dmitriy Novozhilov 331cc1465a [FE] Properly parse java class name from sources if java class has annotations
^KT-56847 Fixed
2023-02-23 12:14:15 +00:00
Dmitriy Novozhilov 94faa759cb [CLI] Rename -XdependsOn flag to -Xdepends-on to keep convention
^KT-56209
2023-02-17 14:09:30 +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
Dmitriy Novozhilov 77caa31640 [CLI] Add CLI arguments to pass HMPP module structure to the compiler
^KT-56209
2023-02-17 11:08:50 +00:00
Ilya Chernikov e39eb62e6e FIR LT: Fix diagnostic location calculation on the last line
it was calculated incorrectly on the last line that do not end
with EOL.
#KT-56649 fixed
2023-02-16 10:21:03 +00:00
Svyatoslav Scherbina cf4934f539 [FIR2IR] Make convertToIrAndActualize() more reusable across backends 2023-02-07 14:16:30 +00:00
Ivan Kochurkin a9bac2f18b Add PackageAndMetadataPartProvider interface
Use it for parameter in MetadataSymbolProvider
2023-02-07 14:16:29 +00:00
Ivan Kochurkin f3e3cc0037 [FIR] Implement support of MPP in JS CLI 2023-02-07 14:16:29 +00:00
Nikita Bobko 62b27b4613 Cleanup: drop KlibIrVersion
Review: https://jetbrains.team/p/kt/reviews/8401
In scope of: KT-55082

Because this version isn't used for anything. We have KotlinAbiVersion
to version the IR format.
2023-02-01 15:13:34 +01:00
Ivan Kochurkin 0f9107c153 [FIR2IR] Remove passing excess arguments to jvm backend functions and classes
generateModuleInFrontendIRMode, runBackend

FirJvmBackendExtension, ModuleCompilerIrBackendInput
2023-02-01 11:42:45 +00:00