Commit Graph

92394 Commits

Author SHA1 Message Date
Alexander Udalov ba20549e13 Fix JVM target in tests using boolean comparisons
These tests don't work on JVM target 1.6 after 6d664bcd10 because we're
generating `Boolean.compare` which is only available since 1.8. (It is
not a big deal because JVM target 1.6 is prohibited for users now.)
2022-05-06 03:47:25 +02:00
Alexander Udalov 6d664bcd10 JVM IR: fix operand type for CompareTo intrinsic
It's incorrect to take the first parameter type from the expression
itself because it can be nullable if smart casts are used. And if it's
nullable, it's mapped to the wrapper type and calling
`comparisonOperandType` for it makes no sense. Instead, take the type
from the callee function, as it's guaranteed to be mapped to a JVM
primitive type.

E.g. in `test1` function in the added test, the problem was that the
dispatch receiver type of the call expression is `Double?`, which is
mapped to `java/lang/Double`, whereas we clearly wanted to obtain the
primitive `D` (double) type.

 #KT-52163 Fixed
2022-05-05 23:06:21 +02:00
Zalim Bashorov f8ef028da3 [Wasm] Remove no longer existed dirs from exclude list 2022-05-05 21:03:40 +00:00
Zalim Bashorov 11d9751844 [Wasm] Unmute inlineVararg 2022-05-05 21:03:39 +00:00
Zalim Bashorov 76806eba8a [Wasm] Mute failing tests in boxInline 2022-05-05 21:03:38 +00:00
Zalim Bashorov e594cad02a [Wasm] Add tests from "boxInline" 2022-05-05 21:03:38 +00:00
Zalim Bashorov 2c20a71d08 [Codegen tests] Specify JVM as target backend for inferenceFlexibleTToNullable.kt 2022-05-05 21:03:37 +00:00
Zalim Bashorov a6e8912af0 [Wasm] Mute failing tests in box/delegatedProperty 2022-05-05 21:03:36 +00:00
Zalim Bashorov db4888b3d4 [Wasm] Stop excluding a bunch of tests 2022-05-05 21:03:34 +00:00
Zalim Bashorov 92d4c1c275 [Build, JS] Remove redundant setting nodeVersion to 16.13.0
Node.js support already use 16.13.0.

Probably it's useful to use default version for dogfooding propose,
Likely it's cover small cases, but at least could help to catch some
platform dependent issues.
If we need some specific (likely newer) version of node somewhere
in the project it's better to specify it for specific parts and
consider updating version of node inside gradle support and revert
a change.
2022-05-05 15:47:54 +00:00
Zalim Bashorov 6ebeeabe0f [Codegen tests] Fix the test (kt39588)
For negative case, throwing CCE, we already have the issue KT-8135
and dedicated tests:
* genericDelegateUncheckedCast1.kt
* genericDelegateUncheckedCast2.kt

Related issues: KT-8135 KT-39588 KT-48749 KT-49837
2022-05-05 15:47:54 +00:00
Mads Ager c6d7c23940 Always take java source before class files.
Also when searching for inner classes.

^Fixes KT-51025
2022-05-05 13:21:06 +02:00
Svyatoslav Scherbina 84b0e0b934 Bump Kotlin/Native version to 1.7.20-dev-853 2022-05-05 10:51:41 +00:00
Ilya Kirillov 82bfa3db05 [fir low level, refactoring] refactor LLFirSessionFactory 2022-05-05 10:43:13 +02:00
Ilya Kirillov f5c95f8a12 [fir low level, refactoring] remove registration of unused service 2022-05-05 10:43:13 +02:00
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