Commit Graph

103116 Commits

Author SHA1 Message Date
Dmitrii Gridin 8a906004e3 [LL FIR] do not resolve declarations from script separately
It leads to exceptions because of race.
We shouldn't try to resolve a script and its content simultaneously,
because it is not thread-safe

^KT-60728
2023-07-27 12:02:05 +00:00
Dmitrii Gridin 6fa254c353 [LL FIR] merge diagnosticTraversalCounter testData to fileStructure
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin 9970663a2b [LL FIR] add script tests for AbstractFirContextCollectionTest
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin 3ed5ccbb6f [LL FIR] add script tests for AbstractFileStructureTest
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin c79bdd8ce3 [LL FIR] drop granular resolve from scripts
Effectively, KtScript currently resolves as a monolith,
so we have problems because some declarations have
their own locks, but some others are not
This change fixed many exceptions

^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin e248d1a588 [LL FIR] add script tests for AbstractFileBasedKotlinDeclarationProviderTest
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin aa36e2ef5b [LL FIR] add script tests for AbstractNonLocalDeclarationAnchorTest
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin 60dc0ace47 [LL FIR] add script tests for AbstractClassIdTest
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin c01c113af4 [AA] implement infrastructure for scripts
^KT-60728
2023-07-27 12:02:04 +00:00
Dmitrii Gridin e5cd674f33 [AA] split KtSourceModuleImpl on separate files
^KT-60728
2023-07-27 12:02:04 +00:00
Mikhail Glukhikh cdd3f10e99 K2: make synthesized functions synthesized in protobuf
Related to KT-59171
2023-07-27 11:24:09 +00:00
Nataliya.Valtman ed2dd4b2ae Split Gradle and JPS metrics
#KT-58026 In progress
2023-07-27 11:18:54 +00:00
Abduqodiri Qurbonzoda 524df83265 Deprecate kotlin.jvm.internal.collectionToArray 2023-07-27 11:16:58 +00:00
Abduqodiri Qurbonzoda 7fc90c02f1 Rename copyToArrayImpl to collectionToArray 2023-07-27 11:16:58 +00:00
Abduqodiri Qurbonzoda 7010bf2c20 Move copyToArrayImpl implementation to Common source set 2023-07-27 11:16:58 +00:00
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