Commit Graph

377 Commits

Author SHA1 Message Date
Mads Ager 6622846bc1 [JVM IR] Do not put destructuring params or underscores in LVT.
Putting them in the local variable table means that the debugger
needs to have special handling for parameters with specific names.
That forces us to generate mangled names for these.

Instead of also implementing the name mangling for FIR, this
change gets rid of the parameters from the LVT instead.
2021-11-02 15:13:14 +03:00
Aleksei.Cherepanov 276fb77155 Fix incremental build after changing Java const used as class property
Report Java static final constant with InlineConstantTracker, used as class property in Kotlin for further registration in JPS

#KT-49177 Fixed
2021-10-20 15:06:19 +03:00
Alexey Subach ca2f37f6eb Add possibility to get location of the script.main.kts file
#KT-48414 fixed
2021-10-11 15:45:57 +02:00
Ilya Muradyan 58831eacca [scripting] Make properties from destructing declarations available with reflection 2021-10-07 18:17:21 +03:00
Vyacheslav Gerasimov f91d6958a8 Build: Rework runtimeJar helper and drop redundant configuration
#KTI-559
2021-09-26 20:10:29 +03:00
Vyacheslav Gerasimov ab146bd6d4 Build: Fix deprecated Gradle configurations usages
for migration to Gradle 7+ #KTI-559
2021-09-26 18:28:44 +03:00
Alexander Udalov 5d6ca27c93 JVM IR: introduce CodegenFactory.convertToIr
The steps of psi2ir and JVM backend need to be separated in the API
because in case of cyclic module dependencies (which are allowed in JPS)
psi2ir should be run first on all sources, and then JVM backend on each
module separately. `CodegenFactory.convertToIr` does nothing in the old
backend.

Also, move the ignoreErrors to GenerationState for simplicity.
2021-09-17 17:39:48 +02:00
Alexander Udalov 5df316a129 Minor, rename module backend.jvm:backend.jvm.entrypoint -> backend.jvm.entrypoint 2021-09-14 22:29:13 +02:00
Alexander Udalov eee8b033a6 JVM IR: minimize usages of jvmPhases outside backend.jvm 2021-09-14 22:29:12 +02:00
Dmitriy Novozhilov d46e2dd749 Fix OVERRIDE_DEPRECATION warnings in project code 2021-09-02 15:04:07 +03:00
Ilya Chernikov 4243bafd1d Scripting: implement correct disposal of REPL state on finalization
#KT-47927 fixed
2021-08-24 21:39:38 +03:00
Ilya Chernikov a45e31720c Make state of the default REPL compiler explicit and replaceable
restores proper object hierarchy in case the legacy REPL infrastructure
2021-08-24 21:39:37 +03:00
Ilya Chernikov e60e80f19a Scripting: improve reporting on cyclic dependency
#KT-48177 fixed
the issue is in fact fixed by the previous commit (report error
on duplicated import) by normalizing import path before processing,
but here we're making error reporting nicer for the case.
2021-08-24 21:39:33 +03:00
Ilya Muradyan 41e2deb751 Revert "[minor] Add the test confirming the wrong behavior of KT-48355"
This reverts commit d9c0b9ad5a.
2021-08-23 11:11:52 +03:00
Ilya Muradyan d9c0b9ad5a [minor] Add the test confirming the wrong behavior of KT-48355 2021-08-22 03:28:36 +03:00
Jinseong Jeon 5819959cce Consolidate arrayOf call names 2021-08-18 16:04:36 +03:00
Hung Nguyen 170184dce4 KT-45777: Refactor RuntimeModuleData to support classpath snapshotting
We are working on a feature in the Kotlin Gradle plugin called
`kotlin.incremental.useClasspathSnapshot` to improve incremental
Kotlin compilation.

In this feature, we need to extract ABI information from a .class file.
If the .class file is a Kotlin class, this info can be found in the
class header data. But if the .class file is a Java class, this info is
not readily available.

The RuntimeModuleData class in the ':core:descriptors.runtime' project
can help with that: It uses reflection to generate `ClassDescriptor`s.

However, reflection requires a full classpath to work correctly, whereas
we want to generate a `ClassDescriptor` directly for each class file
(also, reflection is probably slow).

To address that, this commit refactors RuntimeModuleData so that it can
support a generic Kotlin/JavaClassFinder, which can be based on either
reflection or bytecode analysis. The existing code continues to use
reflection while the new feature will use bytecode analysis (e.g., using
the existing BinaryJavaClass).

Bug: KT-45777
Test: Existing tests should pass (this is a refactoring-only change)
2021-08-10 12:29:44 +03:00
Ilya Chernikov df9a3c0300 Restore scripting-ide-services testing, fix coroutines dependency 2021-07-26 21:16:50 +03:00
Denis.Zharkov ea5157cadc Change type of KotlinCoreEnvironment::projectEnvironment type 2021-07-23 21:38:45 +03:00
Nikita Bobko 39fa2b0baf Delete Kotlin IntelliJ IDEA plugin sources
Kotlin plugin sources were migrated to intellij-community:
https://github.com/JetBrains/intellij-community/tree/master/plugins/kotlin

Preserve `jps-plugin/testData/incremental`
because it's used in `compiler/incremental-compilation-impl/test`

Preserve `idea/testData/multiModuleHighlighting/multiplatform`
because it's used in `MppHighlightingTestDataWithGradleIT`
2021-07-21 11:23:43 +02:00
Ilya Muradyan 46bbe5b1cb Replace Ivy resolver with Maven resolver in all places 2021-07-19 21:31:49 +03:00
Ilya Chernikov 0cd29adcc7 Get rid of kotlinx-coroutines usage in scripting libs and plugins
the dependency on the coroutines library caused various problems like
KT-30778, or stdlib/runtime version conflicts.
The only function used was `runBlocking`, so this change replaces it
with the internal implementation based on the similar internal thing
from the stdlib.
#KT-30778 fixed
2021-07-19 16:35:36 +03:00
Ilya Chernikov dee0487185 IR: Refactor IrBuiltIns to abstract it from descriptors 2021-07-16 02:24:18 +03:00
Georgy Bronnikov 20b76d4149 JVM_IR: reorganize initialization of JvmGeneratorExtensionsImpl
CachedFields are now created at initialization.
Therefore we need CompilerConfiguration as a constructor parameter.
2021-07-14 21:20:30 +03:00
Alexander Udalov 7a42f603f2 JVM IR: rename mangler implementation classes 2021-07-13 01:54:41 +02:00
Ilya Muradyan 55ec6729b0 [REPL] Fix completion after final expressions 2021-07-09 04:06:53 +03:00
Ilya Muradyan 787ce6335c Change nestedClasses logic to accept classes with nested type aliases
#KT-47650 fixed
2021-07-08 21:04:53 +03:00
Nikita Bobko 3ca0e11dab Add README to scripting-ide-common
Originally, we though that we would move classes from `ide-common` from Kotlin plugin to this
module but it turns that these classes are heavily used in Kotlin plugin and it's better to
keep them with the rest of Kotlin plugin. So now classes in `scripting-ide-common` are copy-pasted
2021-07-08 10:01:34 +00:00
Nikita Bobko fbe062ee64 [refactoring] Move files in scripting-ide-common into unique subpackage
I am afraid of FQN clashes with classes in `ide-common` in kotlin-ide
2021-07-07 16:51:45 +02:00
Nikita Bobko 339231b05e Move KtFunctionLiteral.findLabelAndCall from kotlin-ide.frontend-independent to compiler.psi
I want to be able to use this function in `:kotlin-scripting-ide-common` & `frontend-independent`

This commit also allows to remove copy-pasted `findLabelAndCall` in `scripting-ide-services` module
2021-07-07 16:51:44 +02:00
Dmitry Gridin a8a6f51a0e [common] fix flexible type approximation in renders
^KTIJ-3030 Fixed

(cherry picked from commit 4855d88a9f6fbce9aeeea6fe1f29dd099a833aed)

KT-CR-2373
2021-07-07 16:51:44 +02:00
Matthew Gharrity 958b0ff24a Ignore diagnostics in ShadowedDeclarationsFilter
During code completion, ShadowedDeclarationsFilter resolves many
synthetic calls (sometimes >1000 for certain projects/scenarios).
By ignoring diagnostics we can avoid running call checkers
during this process (pending a sibling change in the compiler).

Relates to KT-44276 and github.com/JetBrains/kotlin/pull/4027
2021-07-07 16:51:44 +02:00
Matthew Gharrity e2109c3f8f ShadowedDeclarationsFilter: check for equivalence
If there are multiple copies of the same library on the classpath,
then ShadowedDeclarationsFilter becomes very slow because it
encounters many equal-signature declarations and thus has to resolve
a lot of calls in order to pick among them.

Having multiple copies of the same library on the classpath is
somewhat common in real-world projects. It occurs in the
JetBrains/intellij-kotlin project, for example. In that project,
ShadowedDeclarationsFilter ends up resolving thousands of calls,
accounting for around 80% of completion time when there are
many completion results (see KT-44276).

We can optimize ShadowedDeclarationsFilter by checking whether the
descriptors in an equal-signature group are structurally equivalent.
If they are, we can just pick one rather than running resolve.

Testing on a small project with Kotlin stdlib duplicated on the
classpath, this change reduces overhead in ShadowedDeclarationsFilter
from 1200 ms to 20 ms when running completion on the prefix 'a'.
End-to-end completion time is cut in half.

Test: JvmBasicCompletionTestGenerated.Common.Shadowing
2021-07-07 16:51:43 +02:00
Andrei Klunnyi decfcd28d2 KT-39398 Wrong import of unrelated object member is suggested for receiver
Receiver of a function call '<receiver>.foo()' (where receiver is a
class/object/alias name) might be specified incorrectly - corresponding
[companion] object might not be declared.

Before this commit '<receiver>' was considered to be undefined (null).
As a consequence, import suggestion included all 'foo()' functions from
the search scope.

Now as a value of '<receiver>' we set class/object/alias itself
resulting in an empty import suggestion list.
See org/jetbrains/kotlin/idea/util/CallType.kt:307
(#extractReceiverTypeFrom(descriptor: ClassDescriptor)).
2021-07-07 16:51:43 +02:00
Nikita Bobko 365821ae54 2/2 Extract code which is required for :kotlin-scripting-ide-services from ide-common into seprate module
Extract the code and keep it in Kotlin repo. See previous preparation commit as well
2021-07-07 16:51:43 +02:00
Nikita Bobko cf3f35e1c8 1/2 Preparation commit: move ide-common files which are required for scripting to separate directory
This commit is needed to preserve git history
2021-07-07 16:51:43 +02:00
Yahor Berdnikau 7789054547 Migrate repo to use JVM toolchains Gradle feature.
^KT-46972 Fixed
2021-07-05 14:11:12 +00:00
Ilya Muradyan 8be5f009f1 [REPL] Fix completion for function arguments 2021-06-06 09:00:52 +03:00
Ilya Muradyan 9412fe094b [REPL] Copy findLabelAndCall to scripting-ide-services to fix problems with embeddable artifact 2021-05-19 18:32:50 +03:00
Ilya Chernikov d365d7c784 Fix IR compilation for empty script
#KT-46646 fixed
2021-05-17 20:15:14 +03:00
Dmitriy Novozhilov e5b7cf23d6 Drop min functions from addToStdlib.kt 2021-05-14 14:30:20 +03:00
Ilya Kirillov ca320f2f8d FIR IDE: add this labels to keyword completion 2021-05-12 21:40:20 +03:00
Ilya Muradyan e9af2849ef Add Kotlin DeprecationLevel into the REPL completion 2021-05-07 19:56:21 +03:00
Ilya Muradyan b771f9eea4 [REPL] Add completion for the call named parameters 2021-05-04 04:40:00 +03:00
Mikhail Zarechenskiy f8efe3b5df Make function open to overrie it IDE specific part
Namely, this function is overrided in 211 & 212 platforms, see ScriptDefinitionsManager
2021-04-21 20:00:22 +03:00
Vladimir Dolzhenko 590a8d088d Refine locking to avoid dead lock
#KT-46215 Fixed
2021-04-21 11:01:12 +00:00
Vladimir Dolzhenko 613eda5016 Fix PackageFragmentProvider#isEmpty(FqName) for REPL 2021-04-09 21:06:32 +03:00
Abduqodiri Qurbonzoda 40d1849f33 Migrate compiler, idea and others to new case conversion api 2021-04-08 03:22:02 +03:00
Ilya Muradyan d40ada5d07 [REPL] Fix syntax errors analysis and incompleteness detection 2021-03-29 18:36:49 +03:00
Ilya Chernikov bcd7bc5fd7 Fix arguments processing with scriting with old backend by default 2021-03-24 21:26:57 +01:00