Commit Graph

101741 Commits

Author SHA1 Message Date
Dmitriy Novozhilov ba41e8ec38 [IR] Use common expect/actual matching algorithm in IR actualizer
^KT-58578 Fixed
2023-06-10 07:33:29 +00:00
Dmitriy Novozhilov 62534f43c9 [IR] Fix nullability of substituted type arguments in IrTypeSubstitutor 2023-06-10 07:33:29 +00:00
Dmitriy Novozhilov 623019cff1 [FE] Move substitutor related methods to TypeSystemContext
Also use TypeSystemContext instead of TypeSystemInferenceExtensionContext
  in AbstractExpectActualCompatibilityChecker

This is needed to have an ability to implement ExpectActualMatchingContext
  for IR backend. IrTypeSystemContext may operate with type substitutors,
  but there is no sense to implement all methods from TypeSystemInferenceExtensionContext
  in it
2023-06-10 07:33:29 +00:00
Dmitriy Novozhilov 26d7494789 [FIR] Simplify ReceiverValue hierarchy
- Get rid of `AbstractExplicitReceiver` (as there is no explicit usages of it)
- Get rid of `AbstractExplicitReceiverValue` (as there is only one inheritor of it)
- Make `ReceiverValue` an abstract class
2023-06-09 22:51:31 +00:00
Dmitriy Novozhilov 6409bf2fe8 [FIR] Store expressions of receivers inside candidates instead of ReceiverValue
This is needed because of mutable nature of receiver values: implicit
  receiver values can be modified because of smartcasts, but in candidate
  we need to store snapshot of receiver in the form it was at the beginning
  of the resolution

^KT-58823 Fixed
2023-06-09 22:51:31 +00:00
Dmitriy Novozhilov b564260a33 [FIR] Drop ImplicitReceiverValue.expandedType
This field cached expansion of type of implicit receiver, which is incorrect,
  because type of receiver may change because of smartcasts, but this field
  was immutable
2023-06-09 22:51:31 +00:00
Dmitriy Novozhilov c55ddab1bf [Test] Reproduce KT-58823 2023-06-09 22:51:31 +00:00
Dmitriy Novozhilov 8b7cfcda10 [FIR] Add toString() methods to some ConeSubstitutor implementation
This is needed only for pleasant debugging
2023-06-09 22:51:31 +00:00
Roman Golyshev ba6f8e9b23 KT-59199 [Analysis API][FIR] Force resolve of the bodies for the KtFirReferenceShortener and KtFirImportOptimizer
Without it, those services might see outdated FIR elements when the user
changes the PSI.

Related tickets: KT-58257, KTIJ-25785, KTIJ-25749
2023-06-09 23:56:11 +02:00
Ilya Kirillov 724386a5f1 [Analysis API] rework the resolve of the nested name references
To properly resolve qualifier parts in the middle,
we need to resolve the whole qualifier to understand
which parts of the qualifier are package or class qualifiers.
And then we will be able to resolve the qualifier
selected by the user to the proper class, package or callable.

^KT-59189
2023-06-09 21:18:45 +00:00
Ilya Kirillov 785778511b [Analysis API] rework KDoc resolution
1. Optimize it by removing a tower data context collection (KT-59189)
2. Rework the behavior, so it simulates the tower resolve by returning the set of symbols only from the first tower level, which is not empty

^KT-59189 fixed
2023-06-09 21:18:45 +00:00
Alexander.Likhachev 10285b32f1 [Gradle] Restore special handling for OOM as a cause of RemoteException
Fixup to KT-59191
2023-06-09 17:44:41 +02:00
Sergey.Shanshin 441b22c0fd [KxSerialization] Fixed error accessing the descriptor from companion
Relates #KT-57647

If a serialization descriptor is used in the companion, then when accessing the child elements, an array of cached child serializers may be read.
Since the serialization plugin adds its declarations to the class after the declarations from the source code, the initialization of the array of child serializers occurs after the execution of the user code.
This can lead to N PE errors when trying to access an unfilled cached child serializer.

The solution is to change the order of declarations so that the declaration with the property of cached child serializers comes first.

Merge-request: KT-MR-10545
Merged-by: Sergey Shanshin <Sergey.Shanshin@jetbrains.com>
2023-06-09 15:32:28 +00:00
Ilya Kirillov d9cb7b67d4 [Analysis API] move ShortenCommand.invokeShortening to the IDE repository
as Analysis API should not modify the code

^KT-58992 fixed
2023-06-09 14:45:23 +00:00
Ilya Kirillov 95cf892eec [Analysis API] extract the data from the ShortenCommandImpl to the base class
^KT-58992
2023-06-09 14:45:23 +00:00
Troels Bjerre Lund fffc921d42 [K/N] custom_alloc: fix race on extraobject ^KT-55364
This avoids that the thread sweeping the base object can get stale
locals, in the case that the finalizer thread unlinks the extraobject at
the same time. This is done by moving the responsibility of unlinking
the extraobject to the sweeping of the base object.


Co-authored-by: Troels Bjerre Lund <troels@google.com>

Merge-request: KT-MR-10518
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2023-06-09 13:01:00 +00:00
Timofey Solonin 97e48eee7a [MPP] Remove unnecessary platform limitations in CommonizerHierarchicalIT
^KT-58822
2023-06-09 12:24:01 +00:00
Alexander Shabalin 7815eec7c1 [K/N] Rework GC switches with better naming
Additionally, deprecate -Xgc in favour of a new binary option "gc".
This will allow setting gc right in gradle.properties

Merge-request: KT-MR-10498
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2023-06-09 12:04:19 +00:00
Pavel Mikhailovskii fc7af2c9e0 KT-58720 Generate full InnerClass attributes for the standard library; deprecate -Xuse-old-innerclasses-logic 2023-06-09 11:31:17 +00:00
Bogdan Mukvich 1dbe47c039 [CODEOWNERS] Add IntelliJ Kotlin Plugin to OWNER_LIST 2023-06-09 11:56:36 +02:00
Yahor Berdnikau 6aff392434 [Gradle] Fix moduleName is not possible to set in native via compilation
^KT-57823 Fixed
2023-06-09 08:24:14 +00:00
Kirill Rakhman 86836e69e9 [FIR2IR] Unwrap call-site substitution overrides
Generating IR declarations for use-site substitution overrides leads
to IR that is different from K1 as well as problems in signature
generation which relies on mangling. Use-site substitutions can contain
references to type parameters from the call-site which aren't handled
in mangling.

#KT-57022 Fixed
2023-06-09 08:22:21 +00:00
Kirill Rakhman bcdd85758e [FIR] Split origin SubstitutionOverride into declaration and call-site 2023-06-09 08:22:21 +00:00
Kirill Rakhman 67fc46a190 [FIR] Fix handling of type parameters in FIR mangling
#KT-57429 Fixed
2023-06-09 08:22:21 +00:00
Anton Lakotka 938dd65881 [Gradle] test lazy resolved configuration can handle circular dependencies
In gradle it is possible to add dependency to configuration which
is resolved to itself. It is possible due to nature of Configuration
that can contain both: dependencies and artifacts. When configuration
has dependency on itself, it practically means that this dependency
will be resolved to configuration's artifacts.

LazyResolvedConfiguration should be capable to handle such dependencies
2023-06-08 22:10:24 +00:00
Anton Lakotka 2b26b0c540 [Gradle] Add integration test for Icerock Mobile Multiplatform plugin
^KT-59049
2023-06-08 22:10:24 +00:00
Anton Lakotka e5d35f7d1a [Gradle] deprecate android and introduce androidTarget preset
Android preset needs to be removed in favor of Android Pluggable Target

Changes were originally introduced by commit:
becf50ee0f
but then, unfortunately, reverted due to binary compatibility issues

^KT-59049 Verification Pending
^KT-57903 Verification Pending
2023-06-08 22:10:24 +00:00
Anton Lakotka 5a8b6e9603 Revert "[Gradle/MPP] Refactored KotlinTargetContainerWithPresetFunctions"
This reverts commit becf50ee

These changes are binary incompatible due to move of methods with
default arguments.

^KT-59049 In Progress
^KT-57903 In Progress
2023-06-08 22:10:24 +00:00
Leonid Startsev 0cfe2b04f5 Move KmModuleFragment to an internal.common package
because it is klib-related and can be read only with KotlinCommonMetadata.
2023-06-08 17:53:31 +00:00
Leonid Startsev c3d363d1b8 Throw exception instead of returning null from KotlinClass(Module)Metadata.read() 2023-06-08 17:53:31 +00:00
Leonid Startsev 1c629e748f Add JvmStatic + JvmOverloads to writing functions in KotlinClassMetadata
and KotlinModuleMetadata for easier use from Java.
2023-06-08 17:53:31 +00:00
Leonid Startsev 70739df0ad Improve toString() for KmAnnotationArgument 2023-06-08 17:53:31 +00:00
Brian Norman 92cb47a8f9 [FIR] Always report when named arguments are not allowed
#KT-59177 Fixed
2023-06-08 17:25:34 +00:00
Denis.Zharkov 61ed34f4b7 K2: Adjust JDK 21 test data to the latest JvmMappedScope changes
See 2e5b783cc6 for details

After the fix for KT-57694 (mostly rewritten JvmMappedScope),
the behavior of loading new JDK 21 members of K2 has been aligned with K1
2023-06-08 15:53:22 +00:00
Denis.Zharkov d5f24addea K2: Fix isHiddenForThisCallSite for non-direct overridden
Previously, the call of `z.sort` in test has been resolved
to the overridden member
2023-06-08 15:53:22 +00:00
Alexander Udalov b992e698e4 Minor, add regression test for KT-58772
#KT-58772
2023-06-08 15:42:27 +00:00
Alexander Udalov ccf4a6813c Minor, move kt57353 test to a subfolder 2023-06-08 15:42:27 +00:00
Alexander.Likhachev 14460db8e5 [Gradle] Provide relevant error message on daemon crash
#KT-59191 Fixed
Related to KT-55385
2023-06-08 15:34:34 +00:00
Aleksei.Cherepanov 274ac76959 [Build] Fix CCE from gradle publication task 2023-06-08 15:04:43 +00:00
Dmitriy Novozhilov 48c7af171a Advance bootstrap to 1.9.20-dev-3234 2023-06-08 15:04:42 +00:00
Ilya Goncharov 96a4821df6 [Gradle, JS] Rename NPM aggregated configuration
^KT-59116 fixed
2023-06-08 14:40:13 +00:00
Vladimir Sukharev 7aea0af307 [K/N] Enable passed tests for K1/N in involvesInterpreter
^KT-59057

Merge-request: KT-MR-10524
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-06-08 14:13:54 +00:00
Ilya Kirillov b8f15cbbb3 [LL FIR, Java] fix resolve contract violation from java symbol provider
To create a smart psi type pointer, IJ Platform uses resolve.
We cannot use resolve from JavaSymbolProvider, as it may lead to resolve contract violation.

^KT-59133 fixed
2023-06-08 14:13:30 +00:00
Justin Paupore f590e88bdd [Analysis API] Add source shadowing for resolve extensions.
KtResolveExtensions are designed to handle IDE analysis use cases where
source might not be available at analysis time, because that source is
generated by an external source generator, such as an annotation
processor or resource compiler. The sources generated by those external
generators can appear in the analysis scope, and cause issues with
source clash - resolution may find the virtual source from the
KtResolveExtension, the on-disk generated source from the external
generator, or both. This can cause issues, because that on-disk
generated source may be stale, and may not have symbols that will exist
the next time the generator is run (or, conversely, may have symbols
that will disappear on the next build).

To solve this, add a `getShadowedScope(): GlobalSearchScope` to
`KtResolveExtension`. Any files in the module that are included in that
scope will be hidden from resolution, allowing the resolve extension to
cleanly replace those files.

^KT-58834 fixed
2023-06-08 15:55:04 +02:00
Ilya Kirillov 7c87eb098d [FIR] refactoring, use data class instead of a Pair in FirTypeResolver.resolveType 2023-06-08 13:41:35 +00:00
Ilya Kirillov 672cc85949 [LL FIR] remove LowLevelFirApiFacadeForResolveOnAir.onAirResolveTypeInPlace
which is unused now

^KT-58125
2023-06-08 13:41:35 +00:00
Ilya Kirillov 481962d5f6 [LL FIR] get rid of on-air resolve of partial type qualifiers
It's very slow and leads to performance problems (see KT-58125)

Instead, we do the following:

- For a fully resolved type qualifier, when we want to resolve its part,
 we are looking for the corresponding symbol by traversing nested classes
 bottom up.
 - For an error qualifier, we are trying to resolve the maximum possible
  qualifier in the types transformer where all the type scopes are
  already available.

^KT-58125 fixed
2023-06-08 13:41:35 +00:00
Ilya Kirillov 51cf0ce3e5 [FIR] refactoring, extract type resolving to a separate function in FirSpecificTypeResolverTransformer
^KT-58125
2023-06-08 13:41:34 +00:00
Ilya Kirillov 2cd4ff11f0 [FIR] introduce FirErrorTypeRef.partiallyResolvedTypeRef
^KT-58125
2023-06-08 13:41:34 +00:00
Ilya Kirillov da35f436b3 [FIR] refactoring, extract KtUserType -> FirUserTypeRef to a separate function in RawFirBuilder
^KT-58125
2023-06-08 13:41:34 +00:00