Commit Graph

103101 Commits

Author SHA1 Message Date
Abduqodiri Qurbonzoda 6fdfd4e8dd Null-terminate Collection.toArray destination only in JVM
In other platforms the elements following the collection elements
should not be changed.

As a part of efforts to stabilize Native stdlib.
2023-07-27 11:16:58 +00:00
Abduqodiri Qurbonzoda 60455daa9d Update AbstractCollection.toArray documentation 2023-07-27 11:16:58 +00:00
Abduqodiri Qurbonzoda 672a40c7cb [K/N] Remove redundant collectionToArray functions 2023-07-27 11:16:58 +00:00
Nikolay Lunyak 713c2136cc [FIR] Prohibit class literals with empty left-hand side
^KT-59165 Fixed
2023-07-27 10:28:52 +00:00
Yan Zhulanow d748fe7696 [Analysis API] Wrap compilation exceptions in KtCodeCompilationException 2023-07-27 10:23:42 +00:00
Yan Zhulanow f92089cb82 [Analysis API] Move 'allowedErrorFilter' to the 'compile()' parameters 2023-07-27 10:23:42 +00:00
Yan Zhulanow c44925dbed [Analysis API] Add test for inlined local class collection 2023-07-27 10:23:42 +00:00
Yan Zhulanow 7821ef0414 [Analysis API] Make 'KtCompiledFileForOutputFile' an internal API 2023-07-27 10:23:42 +00:00
Yan Zhulanow fcb2b0475e [Analysis API] Improve documentation for 'KtCompilationResult' 2023-07-27 10:23:42 +00:00
Yan Zhulanow 0f6f22d76b [Analysis API] Add API for code compilation
The API replaces 'KotlinCompilerIde' in the IntelliJ IDEA plugin.
Code moved to Analysis API as its K2 implementation severely depends on
the internal compiler API (FIR).

The API is going to be used in the JVM debugger evaluator, and in
the Bytecode Tool Window.

In this commit, only ordinary Kotlin are supported.
In later commits, there will be also support for 'KtCodeFragment' files,
as well as some test coverage.
2023-07-27 10:23:42 +00:00
Yan Zhulanow 441735c2a8 [Analysis API] Support 'analyzeWithAllCompilerChecks()' in FE10 2023-07-27 10:23:41 +00:00
Yan Zhulanow 4b43e72440 [FIR] Create 'FirCodeFragment' with a lazy block if requested 2023-07-27 10:21:29 +00:00
Pavel Kirpichenkov 6896684d36 [LL] Register JvmTypeMapper for common modules with JVM platform
KT-60706
2023-07-27 10:18:54 +00:00
Nikolay Krasko 0fb6382bd6 Include compatible-compose modules
Modules are absent in the repository by default, but can be added from
the experimental repository. This a temporal solution for building
compatible compose with the Kotlin master.

KTI-1302
2023-07-27 10:08:25 +00:00
Svyatoslav Kuzmich 19bdec50f2 [Wasm] Add K2 gradle integration test 2023-07-27 10:05:22 +00:00
Svyatoslav Kuzmich 75142230b6 [Wasm] Support Wasm K2 frontend in CLI (KT-57230) 2023-07-27 10:05:22 +00:00
Artem Kobzar 85ee2d71d2 [K/JS] Remove FILE target from JsName annotation and use the new experimental JsFileName annotation instead 2023-07-27 09:44:28 +00:00
Artem Kobzar 029c71ebb1 [K/JS, K/Wasm] Implement enumEntries top-level function ^KT-59712 Fixed 2023-07-27 09:43:01 +00:00
marat.akhin 34b271b13d [KMP] Implement ACTUAL_TYPE_ALIAS_TO_NOTHING/TO_NULLABLE_TYPE errors
^KT-60650 Done
2023-07-27 09:13:37 +00:00
Sebastian Sellmair 7cef7ac639 [Gradle] Restore 'KotlinTargetHierarchyDsl' for easier transition to hierarchy templates
^KT-60596 Verification Pending
2023-07-27 08:07:34 +00:00
Sebastian Sellmair e8004a4034 [Gradle] Implement AndroidGradlePluginIsMissing diagnostics
^KT-60693 Verification Pending
2023-07-27 08:07:11 +00:00
Kirill Rakhman 951b299268 [FIR] Rewrite redeclaration checks
#KT-60124 Fixed
#KT-60573 Fixed
2023-07-27 08:06:20 +00:00
Kirill Rakhman b56f84b533 [IR] Use SpecialNames.NO_NAME_PROVIDED everywhere 2023-07-27 08:06:20 +00:00
Kirill Rakhman 47d0f3593a [FIR] Use SpecialNames.NO_NAME_PROVIDED everywhere 2023-07-27 08:06:19 +00:00
Marco Pennekamp 9e3ce9cf67 [FIR] Move LibraryModuleInfo to the common frontend
- FIR-specific parts of the Kotlin IntelliJ plugin depend on
  `LibraryModuleInfo`, so it should be part of the common frontend.
2023-07-26 19:09:12 +00:00
Vladimir Sukharev ff174dbad9 [FIR2IR] Provide reflection target to adapted function references
^KT-60259 Fixed

Merge-request: KT-MR-11182
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-07-26 19:08:11 +00:00
Marco Pennekamp 017784d24f [LL FIR] KT-60570 Use emptySet in Kotlin symbol names provider to conserve memory
- As mentioned in KT-60570, memory consumption in cached symbol names
  providers is caused partially by lots of instances of empty mutable
  sets. This commit replaces such sets with the `emptySet()` singleton.
- This improvement also makes sense for callable names because the IDE
  "package names with top-level callables" set currently contains all
  package names in the project.
- In my local tests of the `setUp` Find Usages performance test, the
  retained size of `FirDelegatingCachedSymbolNamesProvider` is cut down
  from 208MB to 170MB by the empty class name set optimization, and from
  170MB to 115MB by the empty callable name set optimization.
2023-07-26 19:03:20 +00:00
Mikhail Glukhikh 336ea28735 Drop setting progressive mode in cli / cli-base (related to KT-59171)
This commit prevents language version increase due to bootstrapping
problems. Compiler version X attempts to build the project with the
current version X+1 -> warning about progressive mode cannot be enabled ->
error due to -Werror -> build failure.
2023-07-26 18:19:58 +00:00
Mikhail Glukhikh e76cf24d01 Explicitly use language version 1.9 for K2-unsupported parts
This commit explicitly sets LV 1.9 for all projects with disabled FIR
bootstrap, as well as for libraries, including Native stdlib.

Related to KT-59171
2023-07-26 18:19:58 +00:00
Leonid Startsev 648c1f4599 Support instantiation of annotations with type parameters
By ignoring type parameters. Since type parameters in annotations are a
very limited feature, their sole use is to be able to specify them as
KClass argument: annotation class Foo<T: Any>(val bar: KClass<T>).
Since we can encounter type param only as a KClass type argument (and
never as a property type), simple approach of ignoring them works fine.
In that case, since we simply copy property types to synthetic
implementation class, its properties in IR start look like this:
annotation class FooImpl(override val bar: KClass<T of Foo>). This IR
seems to be not completely correct, since FooImpl.bar type contains T of
Foo param, which is out of its scope. However, so far I didn't
encounter any problems with this during testing and after MR discussion
this approach has been considered possible.

#KT-59558 Fixed
#KT-59036 Fixed
2023-07-26 17:16:13 +00:00
Nikita Bobko 8c795462e1 Effective modality cleanup. Drop unnecessary @Suppress and final
They were needed as a temporary migration in scope of KT-58587

Now the bootstrap and IDE include KT-58587 patch, so @Suppress and
`final` are no longer needed
2023-07-26 16:48:25 +00:00
Yan Zhulanow fefa72fa29 [BE] Use more generic 'FacadeClassSource' in 'parentClassId'
In the IDE's evaluator, the container source for stub-based FIR
declarations is a different implementation of 'FacadeClassSource'.
2023-07-26 16:03:44 +00:00
Pavel Mikhailovskii bbbca94d3c [Analysis API] Get rid of automatic registration of KtLifetimeTokenProvider in StandaloneAnalysisAPISessionBuilder. Introduce KtAlwaysAccessibleLifetimeTokenProvider. 2023-07-26 15:47:05 +00:00
Alexander Shabalin 22d075dcda [K/N] Fix swiftinterop performance build 2023-07-26 15:45:26 +00:00
Alexander Shabalin fefb95a432 [K/N] Fix numerical performance build 2023-07-26 15:45:26 +00:00
Ilya Kirillov 7606aab0dd [LL FIR] fix user code leak from exceptions in :analysis:analysis-api-fir
Also, add more info to some exceptions
2023-07-26 14:29:20 +00:00
Ilya Kirillov e3d2bccb33 [LL FIR] fix user code leak from exceptions in :analysis:low-level-api-fir
Also, add more info to some exceptions
2023-07-26 14:29:20 +00:00
Abduqodiri Qurbonzoda df16fa3306 [K/N] Regex matching zero length should split surrogate pairs #KT-57401
Merge-request: KT-MR-11110
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-07-26 14:19:25 +00:00
Pavel Mikhailovskii 7ecd7b8e61 [KAPT] Refactor Kapt 3 components for reuse in Kapt 4 (KT-51982)
- make some utility functions and classes public
- split some classes into common and Kapt 3 - specific parts
- use Kapt 4-ready filtering of @Metadata annotations in tests
2023-07-26 14:03:14 +00:00
Yan Zhulanow c702f00399 [LL API] Avoid implicit types in stub-decompiled annotations 2023-07-26 13:02:46 +00:00
Ilya Goncharov 1f9af4b452 [Gradle, JS] Fix cli tests for ir
KT-60495
2023-07-26 12:51:37 +00:00
Yahor Berdnikau 3b878336dd [Gradle] Fix additional java resource dirs are erased on KGP/Jvm plugin apply
User scripts may apply KGP/Jvm plugin not immediately in 'plugins {}'
block. And a script may also already add some additional resources into
a java source set before plugin apply. On apply plugin has erased such
additionally configured resource dirs as it assumed only the default one
are set. Now it also syncs them.

^KT-60459 Fixed
2023-07-26 12:50:51 +00:00
Yahor Berdnikau 11cefc52a7 [Gradle] Introduce ResourcesIT test suite
This suite will check how resources are handled in the plugin.

^KT-60459 In Progress
2023-07-26 12:50:51 +00:00
Dmitrii Gridin 3518aa5898 [LL FIR] ANNOTATIONS_ARGUMENTS_MAPPING: drop intermediate state with lazy arguments
This is safer because we can be sure that no one can
read an intermediate result with lazy expressions (related to KT-60387)

^KT-60552 Fixed
2023-07-26 12:27:16 +00:00
Dmitrii Gridin 65fec8dc19 [LL FIR] StateKeeper: provide context
We need this to be able to construct new elements on the fly
during arrangement

^KT-60552
2023-07-26 12:27:16 +00:00
Pavel Kunyavskiy 38ef5be217 [K/N] Don't store private signatures in symbol table
Refactoring in 4986cb14 introduced an unintentional behavior change:
private symbols are now findable in symbol table with lookup by
signature.

Unfortunately, this is not correct - private symbol signature might not
be unique (or at least was sometimes not unique in older compiler
versions), which leads to crashes on deserializing corresponding klib.

This commit restores old behavior.

^KT-60616
2023-07-26 12:03:26 +00:00
Ilya Kirillov cc27bfd39a [Analysis API] fix "scope for class ConeClassLikeTypeImpl not found exception" when stdlib is missing
^KT-60641 fixed
2023-07-26 10:53:56 +00:00
Ilya Goncharov bfe73567c1 [Gradle, JS] Remove deprecated methods for methods with Action input parameter to be chosen
^KT-60218 fixed

Merge-request: KT-MR-11280
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>
2023-07-26 10:32:45 +00:00
Abduqodiri Qurbonzoda 86c1e0ded6 Remove reified constraint from Array constructors #KT-57363
This is an attempt to bring consistency to array constructors reified requirement.
Currently,
JVM - reified type in all three: arrayOfNulls, arrayOf, emptyArray
Native - reified in arrayOfNulls and arrayOf, but not in emptyArray
JS & Wasm - reified in arrayOfNulls, but not in arrayOf and emptyArray

Merge-request: KT-MR-11005
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-07-26 10:17:45 +00:00
Ilya Gorbunov 2a24eaeb74 [Docs] Minor api docs improvement 2023-07-26 10:15:45 +00:00