Commit Graph

92379 Commits

Author SHA1 Message Date
Ilya Kirillov 4ff38c9697 [fir low level, refactoring] rename LLFirModuleResolveState -> LLFirResolveSession 2022-05-05 10:43:13 +02:00
Ilya Kirillov 7b70cf3ae0 [fir low level, refactoring] rename rootModule -> useSiteModule 2022-05-05 10:43:13 +02:00
Ilya Kirillov 4825de3ed8 [fir low level] extract library session caching to a separate class 2022-05-05 10:43:12 +02:00
Ilya Kirillov 7c202948cd [fir low level, fir] extract empty FirPredicateBasedProvider to a separate class 2022-05-05 10:43:12 +02:00
Ilya Kirillov 71819a8cb9 [fir low level, refactoring] rename some classes to match the naming pattern 2022-05-05 10:43:12 +02:00
Nkolay Krasko 239d969f99 Remove source sets from the instrumentation task 2022-05-04 22:50:22 +00:00
Nkolay Krasko 0b6b129cc0 Disable erroneously enabled compilation during the instrumentation 2022-05-04 22:50:22 +00:00
Vyacheslav Gerasimov dcd17e41a4 Fix capitalization related deprecation warnings 2022-05-04 19:15:01 +00:00
sebastian.sellmair 40d62bf1a7 :tools:binary-compatibility-validator: Remove explicit kotlinx-metadata-jvm dependency
The kotlinx:binary-compatibility-validator dependency is expected
to bring this dependency in.

KT-52045
2022-05-04 18:31:40 +00:00
sebastian.sellmair fd0645548d Update binary-compatibility-validator to v0.9.0
KT-52045
2022-05-04 18:31:39 +00:00
Alexander Korepanov 9e591f3299 [JS IR] Add a test for external property accessor with a side effect. 2022-05-04 13:14:07 +00:00
Alexander Korepanov 57f16e801f [JS IR] Materialize Unit more aggressively for IrCalls
Unit materialization for IrCall is required for operations with dynamic type.

However it produces useless Unit_getInstance() calls,
especially in return expressions. The pach also adds some heuristics
for reducing the amount of Unit_getInstance() calls from return expressions:
do not add Unit_getInstance() if return value has Unit type.

Relaited to KT-51139
^KT-23252 Fixed
2022-05-04 13:14:06 +00:00
Mikhail Zarechenskiy 677ec12b50 Revert "[EE-IR] Minor: run local function patching on all fragment code"
This reverts commit 722d876675.
Unfortunately, this commit breaks debugger tests in intellij part
2022-05-04 14:56:33 +02:00
Artem Kobzar e1dd8d3868 test: generic classes exportability. 2022-05-04 11:25:34 +00:00
Artem Kobzar 729e24d053 fix: make sealed classes abstract inside d.ts files. 2022-05-04 11:24:47 +00:00
Artem Kobzar a2b40acc98 feat: add WARNING on usage top-level exportable declarations with non-consumable identifiers. 2022-05-04 11:22:57 +00:00
Ilya Muradyan 0ea9c1fbce [Scripting] Remove obsolete Aether dependencies and add new maven.resolver ones instead
scripting-dependencies-maven actually depended on both maven.resolver
and Aether dependencies, it caused an issue in KScript
(https://github.com/holgerbrandl/kscript/issues/345) and caused some
issues in the past. These problems were partially solved with exclude()
which is now removed.
2022-05-04 10:31:02 +00:00
Hung Nguyen 3321a1b4e2 [NewIC] Fix build failure when enabling new IC in projects using Kapt
Originally, the classpath-snapshot output directory was:
  1. <project>/build/kotlin/<task>/classpath-snapshot for KotlinCompile
  2. <project>/build/tmp/kapt3/classpath-snapshot/<source-set> for
     KaptGenerateStubsTask

In commit 1d1c6d5, we started using location 1 for both tasks for
consistency.

Around that time, commit 46cb490 had a merge conflict with the above
commit, but the conflict resolution was not correct yet:
  - The property was set twice, causing a build failure.
  - Location 2 was set for KaptGenerateStubsTask again.

This commit fixes both issues, so that:
  - The property is set only once.
  - Location 1 is used for both tasks.

Test: Added Kapt3IT.testSimpleWithIC_withClasspathSnapshot to prevent
      regression

^KT-52187 Fixed
2022-05-04 12:43:19 +03:00
Nikita Bobko 74307ad434 JpsUtils.isJps: fix NoClassDefFoundError
This commit fixes:

    Caused by: java.lang.NoClassDefFoundError: com/intellij/openapi/components/ComponentManager
      at java.base/java.lang.ClassLoader.defineClass1(Native Method)
      at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
      at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
      at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
      at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
      at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
      at java.base/java.security.AccessController.doPrivileged(Native Method)
      at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
      at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
      at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
      at java.base/java.lang.Class.getMethodsRecursive(Class.java:3307)
      at java.base/java.lang.Class.getMethod0(Class.java:3293)
      at java.base/java.lang.Class.getMethod(Class.java:2106)
      at org.jetbrains.kotlin.config.JpsUtilsKt$isJps$2.invoke(JpsUtils.kt:17)

In c1f2d66ed8 I replaced
`ApplicationManager.getApplication() == null` with
`Class.forName("ApplicationManager").getMethod("getApplication").invoke(null)`.
It turned out that those two are not equivalent.

`getMethod` tries to match queried signatures with existing signatures
=> it tries to load classes in signatures => it tries to load
`com.intellij.openapi.application.Application` (and fails because
`Application` supertype isn't in the classpath).

Contrary, `ApplicationManager.getApplication() == null` doesn't try to
load `com.intellij.openapi.application.Application` class, so it doesn't
fail.

I use MethodHandles API because it forces me to write `Class.forName`
myself (compared to implicit `Class.forName("Application")` inside
`getMethod`) which I find a nice safety feature.
2022-05-04 09:15:17 +00:00
pyos 239bcea3b9 JVM: write back to tailrec function parameters if possible
This makes the debugger update the values when entering a recursive
call, and also uses fewer variable slots.

This may also work on the JS backend, but Native would probably require
something else.

^KT-47203 Fixed
2022-05-04 10:00:08 +02:00
pyos ca446f008e IR: add a do-while builder function 2022-05-04 10:00:08 +02:00
Kristoffer Andersen 4614ca94c5 Update analysis-api.md 2022-05-04 02:27:23 +02:00
Kristoffer Andersen 722d876675 [EE-IR] Minor: run local function patching on all fragment code 2022-05-04 01:41:13 +02:00
Florian Kistner def664eda9 KMA-413 Fix parseBinaryOptions missing from backend-native-for-ide 2022-05-03 23:51:34 +02:00
Yahor Berdnikau e38ca74927 Fix compilation warnings in 'pill-importer' project
These warnings have fail compilation with bootstrap.
2022-05-03 11:47:30 +00:00
Yahor Berdnikau e4c84032e1 Fix users could not configure task using deprecated dsl.KotlinJvmOptions
^KT-52239
2022-05-03 11:47:29 +00:00
Ilya Muradyan cfd11f2075 [Scripting] Provide better errors reporting for authentication issues
^KT-50357
2022-05-03 03:42:47 +00:00
pyos effd21d074 JVM_IR: do not optimize suspend$$forInline functions
`$$forInline` functions do not pass through the state machine generator,
and optimizing `Ref`s before that changes how assignments inside lambdas
passed to `suspendCoroutine`, etc. behave: without a `Ref`, the
assignment is not reflected in the continuation object, so the variable
has old value on resumption.

These functions will be optimized later, after they are inlined
somewhere and the state machine is generated.

^KT-52198 Fixed
2022-05-02 20:18:08 +02:00
pyos 153f878df4 Convert OptimizationClassBuilder to Kotlin 2022-05-02 20:18:08 +02:00
pyos 0ec5975730 JVM: ignore non-meaningful instructions during peephole optimization
Also, produce more nops, since they no longer take up memory for frames
and a later pass will remove the unneeded ones anyway.
2022-05-02 19:28:10 +02:00
pyos c43acba0b9 JVM: restore call site line number after inlining lambda
E.g. in `x + f()` where `f` is an inline lambda, the instructions for
`+` should have the line number of that expression (while previously
they instead had the line number of the last line of the lambda).

^KT-51738 Fixed
2022-05-02 19:28:10 +02:00
pyos 9d3a5e93d4 JVM: reuse Frames of instructions that do nothing
This saves some RAM when optimizing functions with lots of line numbers.
2022-05-02 19:28:10 +02:00
pyos db62640ae2 JVM: remove InlineOnlySmapSkipper
1. the class didn't make much sense anyway;
2. the same code is useful for default lambdas, which can also have
   a line number equal to the call site.
2022-05-02 19:28:10 +02:00
konstantin.tskhovrebov 9220d47594 KT-51861: Apply custom cocoapods framework name to fat framework. 2022-05-02 14:46:40 +00:00
Mikhail Zarechenskiy 24220cbfb5 KotlinBinaryClassCache: restore missing fixes after merge to Kotlin repo
- Avoid lookups in branches: https://github.com/JetBrains/intellij-community/commit/c904c56bb4ac9764935aed09e2107636e2e5bb68
 - Don't fail during index of incorrect class files: https://github.com/JetBrains/intellij-community/commit/3af051e3d30e773d9dfe6cb388a42387b8636c6b

 ^KTIJ-21472 In Progress
 Also, this commit fixes projectLeak in Intellij Aggregator _LastInSuiteTest.testProjectLeak[Java Tests / 3]
2022-05-02 12:21:43 +00:00
Yahor Berdnikau c345f01a79 Fix IDEA Gradle import error 2022-05-02 12:02:30 +02:00
Mikhail Glukhikh 15d58aff92 K2: drop C/DFA warning which fixes can break compilation in K1 till 1.8
#KT-50965 Fixed
2022-05-01 16:40:04 +00:00
Nikolay Lunyak cc086bed58 [FIR] Use a tree with the proper root node
This commit ensures all the conversions inside the lambda expression
use the correct tree reference.

Otherwise, the problem arises in the
`toFirSourceElement()` call: if called form inside the
ExpressionsConverter, everything is OK, but calling it from inside
DeclarationsConverter will result in the wrong source text range.
This happens, because during the lambda expressions conversion a custom
ExpressionsConverter is created with the `lambdaTree` tree, but the
DeclarationsConverter continues to use the previous tree.
2022-04-30 19:51:57 +00:00
Alexander Shabalin caf90de2b8 [K/N] Compile runtime tests in parallel.
Merge-request: KT-MR-6164
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-04-29 20:30:57 +00:00
Pavel Punegov d5b450c8fa [K/N][publish] Fix getting the extracted dir name
Python's rstrip() method with argument removes not the string
but all combinations of specified chars
2022-04-29 17:34:35 +00:00
Nikita Bobko c1f2d66ed8 Kotlin JPS plugin: drop intellij-core dependency
Drop dependency because
https://youtrack.jetbrains.com/issue/IDEA-292483/UnsupportedClassVersionError-when-trying-to-run-JUnit5-unit-test#focus=Comments-27-6034750.0-0

IDEA plans to drop `PathUtil` from JPS classpath, we should prepare to
that

`KotlinFacetSettingsProvider` isn't used in jps so it was moved into
intellij repo. It was moved to
`community/plugins/kotlin/idea/src/org/jetbrains/kotlin/config/KotlinFacetSettingsProvider.kt`
path (so you can find it git history)

Review: KT-MR-6195
2022-04-29 14:51:03 +02:00
Ilya Goncharov 1fc7fbed79 rra/ilgonmic/export-call-site
[JS IR] Add test with exported overridden property from interface

[JS IR] Accessors should not be exported when overridden from non-exported interface

Merge-request: KT-MR-6166
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>

^KT-52144 fixed
2022-04-29 12:13:09 +00:00
Ilya Chernikov cdb5845693 [minor] fix double warning about FastJarFS 2022-04-29 11:03:13 +00:00
Ilya Chernikov a78d063bef Scripting: fix script type extraction on psi2ir
#KT-48812 fixed
2022-04-29 11:03:12 +00:00
Ilya Chernikov 3e19e9d190 Scripting: fix loadDependencies property use with cached scripts
#KT-50902 fixed
2022-04-29 11:03:12 +00:00
Ilya Chernikov f7fb586ee5 Scripting: fix JSR-223 invocable handling of receivers 2022-04-29 11:03:12 +00:00
Ilya Chernikov 49902bb851 IR Scripting: allow to specify nullable types for provided props...
but only explicitly. This does not fix a breaking change described in
#KT-52120, because it seems the correct behavior, but it allows
to "workaround" the problem by specifying nullability explicitly.
Also improve handling of nullable bindings in JSR-223.
#KT-49173 fixed
#KT-51213 fixed
2022-04-29 11:03:11 +00:00
Alexander Shabalin 4a66cd0c69 [K/N] Remove usage of legacy allocation stuff ^KT-52130
Merge-request: KT-MR-6182
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-04-29 10:12:44 +00:00
Yahor Berdnikau cb35e868cc Don't add Kotlin specific attributes to legacy 'default' configuration
^KT-51913 Fixed
2022-04-29 08:29:34 +00:00
Dmitriy Novozhilov c2bb8d6de0 [Test] Fix CLI tests due to migration from -Xuse-fir to -Xuse-k2 flag 2022-04-29 12:26:01 +04:00