Commit Graph

3003 Commits

Author SHA1 Message Date
Roman Golyshev ffcbc583d0 FIR: Split EnvironmentConfigurator to an interface and abstract class
It is needed to make it easier to write wrappers for configurators
2022-02-25 23:08:26 +03:00
Roman Golyshev 62f0487efa FIR: Set resolve phase to BODY_RESOLVE for the generated declarations
In the future it should be checked that plugins can return only
`BODY_RESOLVE`d declarations
2022-02-25 23:08:25 +03: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
Ivan Gavrilovic 72532f6f03 KT-41456: Incremental KAPT - optimize .class file counting
When counting .class files, stop once the required number is reached.
Also, implement simple counting logic directly, it is 25% faster than
using File.walk(). The way this information is used is a heuristic, so
reducing computation cost makes sense.

^KT-41456 Fixed
2022-02-21 18:10:03 +03:00
Ivan Gavrilovic 0074e0209c KT-41456: Incremental KAPT - check compiled sources before running incrementally
Because incremental KAPT tries to reuse .class files produced by kotlinc
and javac, it should check for their existence before starting
an incremental run. Otherwise, annotation processors that perform type
validation will fail to run.

Current check counts the number of declared types in processed .java
sources, and it makes sure the total number of .class files in compiled
sources dirs is equal or higher. Otherwise, KAPT runs non-incrementally.

Tests: KaptIncrementalWithIsolatingApt.testMissingKotlinOutputForcesNonIncrementalRun

^KT-41456 In Progress
2022-02-21 18:10:00 +03:00
Ivan Gavrilovic c7e73ce88d KT-41456: Incremental KAPT - represent source and class file structure differently
When storing source information needed for type analysis, store
.java file and .class file information separately. This is because
for class files only declared typed is needed.

Tests: updating existing ones

^KT-41456 In Progress
2022-02-21 18:09:58 +03:00
Dmitriy Novozhilov d4d22b0dcf [FIR] Add plugin prototype for testing extension for injection receivers 2022-02-18 17:52:34 +03:00
Dmitriy Novozhilov b47cc86c57 [FIR] Fix incorrect context usages with withSuppressedDiagnostics call 2022-02-18 17:44:40 +03:00
Mikhael Bogdanov ccbecbaccb KAPT+IR: Update tests 2022-02-17 12:26:42 +01:00
Mikhael Bogdanov 7b767aaa1c KAPT+IR: Don't clear binding context if KAPT is used 2022-02-17 12:26:42 +01:00
Mikhael Bogdanov f05c72d48f KAPT+IR: Properly process annotations and backing field annotations 2022-02-17 12:26:42 +01:00
Mikhael Bogdanov ea2bf3c867 KAPT+IR: Support -Xjvm-default modes 2022-02-17 12:26:41 +01:00
Mikhael Bogdanov 00f2b83b84 KAPT+IR: Support @JvmOverloads annotation 2022-02-17 12:26:41 +01:00
Mikhael Bogdanov 7ec19d015c KAPT+IR: Properly process repeatable annotation
~review fix
2022-02-17 12:26:41 +01:00
Mikhael Bogdanov d810d93578 IR: Keep annotations in enum constructor during lowering 2022-02-17 12:26:40 +01:00
Alexander Udalov 032d69aa41 Kapt: handle special names correctly
Parameter names of some methods are different in JVM IR, for example
extension receivers of property `$annotations` methods are named
`<this>`, which made the `Name.identifier` call fail. It seems fine to
use the "p + index" name for this instead.

 #KT-49682
2022-02-08 20:15:14 +01:00
Alexander Udalov 07d3e3a5bd Kapt: support property $annotations methods for JVM IR
`is PropertyDescriptor` check doesn't work for JVM IR where descriptor
is created on-the-fly and is an `IrBasedSimpleFunctionDescriptor`.

 #KT-49682
2022-02-08 20:15:14 +01:00
Alexander Udalov 25edf64daf Psi2ir: support mode without generation of bodies
This is needed for kapt + JVM IR.

 #KT-49682
2022-02-08 20:15:14 +01:00
Alexander Udalov b3820564b0 Kapt: never generate enums as final
Behavior differs between JVM and JVM_IR backends here because in JVM,
the class descriptor comes from the frontend, and its modality for enum
is never final. For JVM IR, the class descriptor is based on IrClass,
whose modality is sometimes final for enum, presumably because it's
easier for backends (see `ClassGenerator.getEffectiveModality`).

 #KT-49682
2022-02-08 20:15:14 +01:00
Alexander Udalov fc2c0eea27 JVM IR: generate source-retained annotations in kapt mode
#KT-49682
2022-02-08 20:15:13 +01:00
Alexander Udalov 1df2851611 IR: use names $this/$receiver for receivers in copied static functions
Similarly to the other places in the IR backend (e.g. see
`copyValueParametersToStatic` in the same file).

In JVM IR, these names are used for example for receiver parameters of
methods copied to DefaultImpls classes. Since Java stub code generated
by kapt mentions them, it fixes a few issues in tests on kapt + JVM IR
(KT-49682).
2022-02-08 20:15:13 +01:00
Alexander Udalov f6d3bb5b1b Kapt: add JVM IR expectations for some tests
All of these have a different order of declarations and/or extra
`@NotNull` annotations on fields, both of which doesn't seem like a
problem.

 #KT-49682
2022-02-08 20:15:13 +01:00
Alexander Udalov bcd221f714 Kapt: use descriptorBasedTypeMapping for type mapping
Since all anonymous types are approximated to a supertype in kapt, type
mapping doesn't require backend information (mapping of anonymous types
to class names) and can be performed statically, independently from
particular JVM backend internals, via descriptorBasedTypeMapping.

 #KT-49682
2022-02-08 20:15:13 +01:00
Alexander Udalov 754ad100a9 Minor, cleanup kapt tests
Fix inspections, reformat
2022-02-08 20:15:13 +01:00
Alexander Udalov 62c1c33ee3 Kapt: slightly improve CustomJdkTestLauncher
- Include stdout & stderr dump to the exception message if the Java
  command fails
- Support running JVM_IR tests
- Do not print anything to the stdout of the test itself in case it's
  successful

 #KT-49682
2022-02-08 20:15:13 +01:00
Alexander Udalov ebb9659e03 Add mode to run kapt with JVM IR, use in tests
Currently JVM IR is not supported in kapt, so almost all tests are
failing, and thus are muted with IGNORE_BACKEND.

 #KT-49682
2022-02-08 20:15:13 +01:00
Dmitriy Novozhilov 0bd3e8f418 [FIR] Rename ConeClassErrorType to ConeErrorType, drop ConeKotlinErrorType alias 2022-02-07 13:36:33 +03:00
Steven Schäfer 78d80181e2 inlineClassUtils: Fix handling of inline classes without constructors
Fixes KT-50992

DeclarationDescriptor.isInlineClass misidentifies inline classes without
constructors. This can happen for the ABI of inline classes with private
constructors.
2022-02-04 23:30:24 +01:00
Alexander Udalov 210cc67041 Android extensions: do not produce unbound symbol for mutableMapOf
#KT-50784 Fixed
2022-02-03 19:14:52 +01:00
Dmitriy Novozhilov aab66bd623 [FIR] Support rendering diagnostic names in CLI FIR compiler 2022-01-28 16:12:12 +03:00
Ilya Muradyan 070f537ee9 REPL: Extract IDE-specific tests to a separate test set 2022-01-27 02:23:28 +03:00
Ilya Muradyan 9637b6b848 REPL: Fix REPL scripts metadata to be correctly recognized by class file decompiler 2022-01-27 02:23:27 +03:00
Georgy Bronnikov 6a3a375372 IR: pass DescriptorByIdSignatureFinder as parameter to DeclarationStubGeneratorimpl
This breaks dependency between serialization.common and psi2ir modules.
2022-01-27 01:02:23 +03:00
Georgy Bronnikov 3cc883cf7b IR: use DescriptorBySignatureFinder in DeclarationStubGenerator
Duplicating code that was used for the same purpose in
DeclarationStubGenerator is removed.
2022-01-27 01:02:14 +03:00
Sergey.Shanshin aa1700f3e7 Fixed serialization with custom serializer for parametrized sealed class
#KT-50764 Fixed
#KT-50718 Fixed
Fixes Kotlin/kotlinx.serialization#1705
2022-01-26 09:42:36 +00: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
Dmitriy Novozhilov bea2bc3980 [Parcelize] Move FIR related parts of parcelize to separate module
This is needed to avoid bundling of FIR classes to IDE plugin for
  parcelize, because it can cause compatibility issues, because
  IDE plugin does not contain FIR compiler
2022-01-21 10:22:39 +03:00
Evgeniy.Zhelenskiy e97ca2ada4 [Psi2Ir, Fir2Ir] Generate toString, hashCode, equals methods for MF VC 2022-01-14 13:51:57 +00:00
pyos 8314b7d3c9 IR/Android: initialize the findViewById cache before super()
In general, calling open methods in open class constructors is unsafe
because their overrides will see an uninitialized instance. This change
makes it at least possible to use the view cache in such cases.

^KT-50627 Fixed
2022-01-10 21:08:43 +01:00
Irene Dea 19bfc43bee Fixes and refactors 2022-01-08 15:25:07 +03:00
mvicsokolova 5c3ce66e99 kotlinx.atomicfu compiler plugin (JS): delegated properties supported (#4692)
* kotlinx.atomicfu compiler plugin (JS): delegated properties supported

* NPE handling fixed

* Scoped delegated properties supported
2021-12-29 18:16:07 +03:00
mvicsokolova 188d073cc3 kotlinx.atomicfu compiler plugin (JS): tracing supported. (#4691)
* kotlinx.atomicfu compiler plugin (JS): tracing supported.

* Erasing trace invocations from both IrBlock and IrBlockBody.
2021-12-27 23:20:08 +03:00
Ilya Muradyan bb34a74abb REPL: Fix completion for protected members 2021-12-24 08:34:40 +03:00
Stanislav Erokhin 61526c9700 Move AbstractJsScriptlikeCodeAnalyser to the kotlin-scripting-compiler-js module 2021-12-23 20:10:19 +03:00
Nikolay Krasko 1e378ed136 Stop publication for kotlin-scripting-compiler-js
Library is in undefined status and might be removed soon.

^KTI-741 Fixed
2021-12-23 03:46:33 +03:00
Nikolay Krasko 8ef20aa045 Remove test dependencies from kotlin-scripting-compiler-js 2021-12-23 03:46:31 +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
Nikolay Krasko 85521f01f8 Update shadow plugin 6.1.0 -> 7.1.1
Version 7.1.1 is absent in jcenter, so additional repository was added
in some modules.

Leave old version in NewMultiplatformIT.kt because of
`This version of Shadow supports Gradle 7.0+ only. Please upgrade.` error.

^KTI-733 Fixed
2021-12-20 21:39:00 +03:00
Vyacheslav Gerasimov 84469d0c68 Build: Fix test runtime for kapt tests 2021-12-16 21:48:29 +03:00
Vyacheslav Gerasimov 944c7990a1 Build: Use fake ideaHome for tests with intellij build number only
#KTI-82
2021-12-16 21:48:24 +03:00