Commit Graph

210 Commits

Author SHA1 Message Date
Ilya Muradyan 00819c421f [REPL] Report script codegen errors in advance 2022-05-18 10:02:58 +03:00
Simon Ogorodnik 58885a1b07 KT-52217 Rename 'use-fir' to 'use-k2', update message 2022-04-28 15:42:42 +00:00
Ilya Chernikov af933b9d3d Switch to FastJarFS for scripting
#KT-51731 fixed
2022-04-20 19:15:12 +00:00
Ilya Chernikov 2044754628 Backend: remove psi files from generation state
pass them explicitly to all destinations. This is a step in attempt to
abstract dependencies on PSI in the GenerationState and related places.
2022-03-30 08:33:59 +00:00
Ilya Chernikov da41fddabb Backend: remove codegen factory from generation state
use it explicitly. This is a step in attempt to abstract dependencies
on PSI in the GenerationState and related places.
2022-03-30 08:33:51 +00:00
Ilya Chernikov f89765eb33 Make JDK classpath roots configuration explicit...
instead of relying on the "configuration files" parameter.
(in the process of migration from KotlinCoreEnvironment).
2022-03-30 08:32:56 +00:00
Ilya Chernikov 9d2cadc908 [minor] scripting fixes in obsolete and test code...
relax acceptedAnnotations extraction rules for obsolete script template
handling code - the previous variant was failing on the typealias
comparison

also reduce warnings and possible exceptions on some test execution
paths
2022-03-30 08:32:48 +00:00
Dmitriy Novozhilov faba9c4272 [CLI] Don't register classpath roots twice
There are two ways how content roots are registered in compiler configuration
  in JVM CLI compiler:
1. Directly from arguments
2. From Module, which build from arguments

And there was a problem that both ways used at the same time in some
  circumstances (regular compilation without .xml module file) which
  caused duplication of all content roots.

Ideal solution for this problem is removal of Module usages at all,
  because it looks like redundant abstraction which just complicate
  things, but it's too scary to remove it, because it hove some none
  trivial usages inside compiler. So to fix problem with duplicated
  roots this commit just removes registration of roots from arguments
  if Module is used
2022-02-23 19:33:51 +03:00
Dmitriy Novozhilov aab66bd623 [FIR] Support rendering diagnostic names in CLI FIR compiler 2022-01-28 16:12:12 +03:00
Dmitriy Novozhilov dd953908df [FE 1.0] Add compiler flag for rendering internal diagnostic names in error messages 2022-01-23 11:14:56 +03:00
Stanislav Erokhin 61526c9700 Move AbstractJsScriptlikeCodeAnalyser to the kotlin-scripting-compiler-js module 2021-12-23 20:10:19 +03:00
Roman Artemev e17f121b23 [JS REPL] Extract JS script/repl parts into separate module
- don't load js evaluation plugin in CLI compiler
2021-12-21 04:15:11 +03:00
Vyacheslav Gerasimov f7a9065b75 Build: Use intellij maven repo instead of downloaded IDEA
#KTI-82
2021-12-16 21:48:23 +03:00
Vyacheslav Gerasimov bc2f0936bd Build: Rename commonDep -> commonDependency 2021-12-16 21:48:19 +03:00
Ilya Chernikov 1450f4d890 Implement property for explicit jvmTarget for script definition...
Apply the property to the default JSR-223 script taking the value from
java.specification.version property, so effectively implementing
jvmTarget detection from current VM.
Also drop enforcing of target 1.8, using common default.
#KT-49329 fixed
#KT-40497 fixed
2021-12-14 13:39:21 +03:00
Ilya Chernikov f0316cde54 [minor] test infrastructure: fix default handling in proc launcher 2021-12-14 13:39:21 +03:00
Ilya Chernikov ec2d6ea5f1 Restore script testing on both backends, fix some tests 2021-12-14 13:39:19 +03:00
Ilya Chernikov 670575696f Remove forced old backend for script compilation, using common default 2021-12-14 13:39:19 +03:00
Ilya Chernikov 6d6de9dd76 Implement tests for script instance capturing in the host tests 2021-12-14 13:39:18 +03:00
Ilya Chernikov 10c5071eda Implement backend error reporting on unsupported script capturing
#KT-30616 fixed
#KT-43995 fixed
#KT-19424 fixed
#KT-49443 fixed
2021-12-14 13:39:17 +03:00
Anastasiya Shadrina 37495bcba0 [FE] Change resolution scheme 2021-12-02 20:23:57 +03:00
Anastasiya Shadrina d923c95671 [FE] Add context receivers to scope 2021-12-02 20:23:22 +03:00
Ilya Muradyan 6917ff7d2a [scripting] Move earlierScripts to the frontend descriptor
^KT-20488 fixed
2021-11-30 09:11:59 +03:00
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 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
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
Denis.Zharkov ea5157cadc Change type of KotlinCoreEnvironment::projectEnvironment type 2021-07-23 21:38:45 +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 787ce6335c Change nestedClasses logic to accept classes with nested type aliases
#KT-47650 fixed
2021-07-08 21:04:53 +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
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
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
Ilya Chernikov 3e458a1efb FIR: Add IncrementalPackagePartsProvider usage in cli...
also refactor IncrementalPackagePartsProvider and parents to simplify
usage
2021-03-24 21:24:18 +01:00
Ilya Muradyan 14d386223b [REPL] Fix unresolved imports caching
Before this fix, if some imports were not resolved during compilation,
this result had been saved in caches, and this import couldn't been
resolved during following compilations even if it was added to the
module dependencies. This commit adds special handling of resolution
caches for the REPL compiler.
2021-03-24 13:35:33 +03:00