Commit Graph

2988 Commits

Author SHA1 Message Date
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
Vyacheslav Gerasimov f7a9065b75 Build: Use intellij maven repo instead of downloaded IDEA
#KTI-82
2021-12-16 21:48:23 +03:00
Vyacheslav Gerasimov 318e001d1b Fix parcelize test dependencies on android plugin layoutlib
#KTI-82
2021-12-16 21:48:22 +03:00
Vyacheslav Gerasimov 049066f8ac Replace systemIndependentPath from Idea with invariantSeparatorsPath 2021-12-16 21:48:21 +03:00
Vyacheslav Gerasimov bc2f0936bd Build: Rename commonDep -> commonDependency 2021-12-16 21:48:19 +03:00
Steven Schäfer 3f22321643 jvm-abi-gen: Do not write kotlin.Metadata default values
See KT-39492. This does not affect compilation, but it causes problems
in IntelliJ.
2021-12-16 16:11:32 +01:00
Aleksei.Cherepanov c998582e13 Fix configuration [JPS] Generate All Tests
Add missing dependency kotlin.core.descriptors.runtime.main instead of only kotlin.core.descriptors.runtime.test dependency,  as ReflectClassUtilKt (in main source set) is needed for tests generation
2021-12-16 13:05:14 +00:00
Dmitriy Novozhilov 23f5c22684 [Test] Update testdata of parcelize 2021-12-15 21:37:32 +03:00
Nikolay Krasko e733aa21d5 Fix error instead of muting it in kapt tests 2021-12-15 19:18:55 +03:00
Nikolay Krasko f2d649a7a1 Add dependency on dist for fir-plugin-prototype
> FirPluginDiagnosticTestGenerated$MemberGen.testClassWithCompanionObject
> java.lang.IllegalStateException: dist/kotlin-stdlib-jvm-minimal-for-test.jar does not exist. Run 'gradlew dist'
2021-12-15 19:18:50 +03:00
Leonid Startsev 4df34a20e7 Fix classSerializerAsObject test that got broken after conflict-merge
with b131c52889
2021-12-15 17:18:18 +03:00
Leonid Startsev 9b9522d714 Allow defining custom KSerializer for non-generic class as a class
Previously only objects were allowed. Due to a bug, this accidentally
worked in old backend.

#KT-46444 Fixed
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/1587
2021-12-14 17:53:09 +00: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