Commit Graph

103075 Commits

Author SHA1 Message Date
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
Ilya Gorbunov 865f392681 [Docs] Use absolute urls in links, new Dokka doesn't support relative 2023-07-26 10:15:45 +00:00
Sarah Haggarty 8e537ec67d [Docs] Update time API description 2023-07-26 10:15:45 +00:00
Sebastian Sellmair f883079988 [Gradle] IdeBinaryDependencyResolver: Support opaque file dependencies
^KT-60612 In Progress
2023-07-26 09:50:12 +00:00
Sebastian Sellmair 6c4ce81237 [Gradle] Implement 'KotlinOutputDependency' to retain information about kotlin produced dependencies
^KT-60612 In Progress
2023-07-26 09:50:12 +00:00
Simon Ogorodnik 973c5770b8 Change ownership of kapt4 to Kotlin JVM 2023-07-26 09:26:13 +00:00
Stanislav Erokhin ecbc40cf92 [mpp] Mark Kotlin12XMppDeprecation as FATAL
Old MPP plugins are deprecated for a long time. It is time to report
fatal error for such cases.
Our stdlib still and kotlin-test still using them, so we cannot just
completely remove them, but there is a way to suppress this error:
kotlin.internal.mpp12x.deprecation.suppress=true

Code for the old plugins (together with the remaining testsdata)
will be completely removed once stdlib and kotlin-test
migration completed. ETA: ~ 2.0-Mx

#KT-60553 Verification Pending
2023-07-26 09:25:50 +00:00
Stanislav Erokhin 955520f69e [Gradle] Fix the verbose rendering for FATAL diagnostics
During the tests we are using the verbose way of render the diagnostic
meaning, that we are adding the diagnostic id to the diagnostic message.
And we previously didn't have that for one case, so we were unable to
detect in tests that diagnostic with FATAL severity was reported
2023-07-26 09:25:50 +00:00
Ilya Chernikov 3ee07eb015 Scripting: add test for implicit receivers with the same short name 2023-07-26 08:49:27 +00:00
Ilya Chernikov 3dc94f3d31 Scripting: fix descriptor extraction, restore main-kts testing
Temporary solution for K1 - see comments in the code
it seems that a scenario reproduced in the MainKtsTest.testKt48812
wasn't covered with analogous changes before.
And it wasn't detected while main-kts tests weren't a part of the
K1 scripting tests.
The test is fixed now, and testing of main-kts is restored.
2023-07-26 08:49:27 +00:00
Ilya Chernikov 776cdbcd3f minor: small cleanup in K2 scripting support code 2023-07-26 08:49:27 +00:00
Ilya Chernikov 895a811b47 K2 Scripting: fix capturing from the imported scripts 2023-07-26 08:49:27 +00:00
Ilya Chernikov 1d88c307ea K2 Scripting: fix locality of script declarations
the script declarations are considered public, at least because they
can be reused from another script then used with the `importedScripts`
configuration property. It also improves the compatibility with K1
scripting.
2023-07-26 08:49:27 +00:00
Ilya Chernikov 020a590df7 K2 Scripting: fix order of arguments processing
and base class handling:
Since in K2 we do not distinguish between script arguments taken from
the base class and provided properties, we need this extra functionality
to preserve the argument order of K1 scripts.
This is a temporary measure, since we're going to deprecate base class
usage at some point (KT-60449), so the relevant constructor arguments
should disappear too.
2023-07-26 08:49:27 +00:00
Ilya Chernikov 96bde033e1 K2 Scripting: add support for imported scripts 2023-07-26 08:49:26 +00:00
Ilya Chernikov d24fc3b581 K2 Scripting: add support for result field 2023-07-26 08:49:26 +00:00
Ilya Chernikov 6c7751b0af K2 Scripting: add support for script implicit receivers 2023-07-26 08:49:26 +00:00
Ilya Chernikov 480ea80fc4 Enable K2 scripting tests 2023-07-26 08:49:26 +00:00
Ilya Chernikov 266a223460 Update scripting plugin autoload logic for K2 2023-07-26 08:49:26 +00:00
Ilya Chernikov 0d7a5c6b1b Scripting: fix string script source location
fixes proper script definition discovery for expressions and other
scripts created from a string.
2023-07-26 08:49:26 +00:00
Pavel Kunyavskiy f420b6c709 [K/N] Enable ir verification in interop_objc_smoke
^KT-57716
2023-07-26 08:32:09 +00:00
Pavel Kunyavskiy 0fbc42de03 [K/N] Remove interop_kt49034_objcprotocol test
It doesn't check anything meaningful after d797505f06

^KT-56028
2023-07-26 08:32:09 +00:00
Mikhail Glukhikh 5836a8aa0b K2: add more tests/fix augmented assignment case around KT-59748 2023-07-26 06:09:15 +00:00
Mikhail Glukhikh f20e2dec31 K2: generate Unit conversion for indexed assignment at raw FIR stage
#KT-59748 Fixed
2023-07-26 06:09:15 +00:00
Mikhail Glukhikh 1832413a02 K2: reproduce KT-59748 2023-07-26 06:09:15 +00:00
Mikhail Glukhikh a428ab6ed6 K2: handle alias-based types nullability properly in ConeTypeContext
#KT-60154 Fixed
2023-07-26 06:02:42 +00:00
Nikita Bobko f4ba5aaf9a [FE 1.0] Prohibit implicit Java actualization in K1
^KT-58545 Fixed
Review: https://jetbrains.team/p/kt/reviews/10561

It's not yet supported in K2 KT-59213

Related tests:
- ApiTest.testStdlib
- RuntimePublicAPITest.kotlinStdlibRuntimeMerged
- KotlinProjectViewTestGenerated.test_Arrays (in Kotlin plugin)
2023-07-25 22:30:09 +02:00