Commit Graph

99988 Commits

Author SHA1 Message Date
Anton Lakotka fd63aee3e5 [Gradle] Test that binary frameworks can be consumed
^KT-57668 Verification Pending
2023-04-04 18:37:30 +00:00
Anton Lakotka ad9b34653a [Gradle] Add kotlinNativeFrameworkNameAttribute for binary frameworks
^KT-57668 Verification Pending
2023-04-04 18:37:29 +00:00
Pavel Kargashinsky ae228ece8a [Gradle][Tests][MPP] Fix test-data for MPP tests 2023-04-04 18:33:33 +00:00
Pavel Kargashinsky 5c56145a19 [Gradle][Tests][MPP] Use MAX_SUPPORTED AGP/Gradle versions for MPP tests 2023-04-04 18:33:33 +00:00
Artem Daugel-Dauge 4b66160afb [Gradle] Support dependencies between pods in CocoaPods plugin
^KT-38749 Verification Pending
2023-04-04 14:13:44 +00:00
Ilmir Usmanov b36e1f1a5b Do not reference object's toString result in exception messages
Since we put object's hash code in toString, we end up in putting
non-stable hash code to constant table, which leads to unstable
binaries.

 #KTI-1193 Fixed
2023-04-04 13:41:03 +00:00
Marco Pennekamp c2acb77b84 [LL FIR] KT-57220 LLFirSessionCache: Clean up symbol provider merging
- `SymbolProviderMerger` encapsulates some boilerplate, which should
  make `mergeDependencySymbolProvidersInto` easier to read and also much
  easier to extend.
2023-04-04 12:45:33 +00:00
Marco Pennekamp 87bcc3ad08 [LL FIR] KT-57220 Don't merge empty synthetic function symbol providers 2023-04-04 12:45:32 +00:00
Marco Pennekamp eac6458500 [LL FIR] KT-57314 Add cache to combined Kotlin symbol providers
- This Caffeine cache is limited to classes for now, but may also be
  tried with callables.
- The cache has a small memory footprint, but still avoids most of the
  unnecessary index accesses. In my local tests, this approach takes 50%
  of the time compared to no caches. A full cache has no performance
  advantage over the limited-size cache in my local tests.
2023-04-04 12:45:32 +00:00
Marco Pennekamp 375288539e [LL FIR] Add NullableCaffeineCache
- `NullableCaffeineCache` wraps a Caffeine cache and allows storing
  `null` values returned by the computation in the form of explicit
  `NullValue`s in the cache.
2023-04-04 12:45:32 +00:00
Marco Pennekamp b805c6e32b [LL FIR] Add Caffeine library dependency
- Our current FIR caches are based on `ConcurrentMap` and thereby do not
  support size and lifetime limits out of the box. For example,
  first-layer caches with a limited size can speed up access of the most
  frequently used elements, while having a small memory footprint.
- Caffeine is a modern and well optimized caching library that allows us
  to create thread-safe and performant caches with various size or
  lifetime limits.
- The cache must support concurrency because session components such as
  symbol providers may be accessed concurrently once parallel resolve in
  the Analysis API has been implemented (see KT-55750). Caffeine caches
  support concurrency.
2023-04-04 12:45:31 +00:00
Marco Pennekamp a7360a54fe [LL FIR] KT-57314 Prepare for getting top-level names from index
- Getting top-level names from `declarationProvider` directly instead of
  from subordinate symbol providers has a lot of potential for
  performance, but the current performance of the index access is worse
  than the iterative version because scopes aren't optimized yet.
- This commit prepares `LLFirCombinedKotlinSymbolProvider` for the
  switch to getting top-level names from `declarationProvider`.
2023-04-04 12:45:31 +00:00
Marco Pennekamp 028d65e402 [LL FIR] KT-57220 Add LLFirSelectingCombinedSymbolProvider
- Classpath order disambiguation will also be needed by the combined
  Java symbol provider, so it makes sense to move it to its own base
  class.
2023-04-04 12:45:31 +00:00
Marco Pennekamp 29276d94ca [LL FIR] KT-57314 Combine Kotlin symbol providers
- `LLFirCombinedKotlinSymbolProvider` combines multiple
  `LLFirProvider$SymbolProvider`s. Its advantages are: combined "names
  in package" optimization, caching, combined index access, classpath
  order disambiguation.
- Scopes can still be optimized with a combined scope instead of a naive
  union scope.

^KT-57314 fixed
2023-04-04 12:45:30 +00:00
Marco Pennekamp 16af67e99c [LL FIR] KT-57314 Allow passing index results to Kotlin symbol provider
- If a `KtClassLikeDeclaration` or all `KtFile`s which contain a
  callable are already known, they can now be passed to
  `LLFirProvider$SymbolProvider` directly. This avoids index accesses in
  `providerHelper`.
2023-04-04 12:45:30 +00:00
Marco Pennekamp bf1ee6ebed [LL FIR] KTIJ-24296 LL FIR symbol provider: Remove function class check
- `LLFirProvider$SymbolProvider` cannot provide synthetic function
  classes, so there is no need to check `isNameForFunctionClass` for the
  `ClassId`.
2023-04-04 12:45:30 +00:00
Ivan Kylchik 32297c0f21 Serialize and deserialize const val's properly for K2 klib
#KT-57312 Fixed
2023-04-04 12:35:54 +00:00
Ivan Kylchik 23b23d5a1e Slightly simplify const deserialization logic in ClassDeserialization 2023-04-04 12:35:53 +00:00
Ivan Kylchik 1eabb55641 [FIR2IR] Unconditionally print only exception message from interpreter 2023-04-04 12:35:53 +00:00
Roman Efremov bcf4528763 [MPP] Forbid actual member in expect class
Such member descriptor will be actual and expect at the same time,
so we should run both checks.

^KT-40903 Fixed
2023-04-04 12:28:00 +00:00
Vladimir Sukharev c3734aa9ce [K2/N] Build platform libs with XCode 14.3
Merge-request: KT-MR-9458
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-04-04 11:41:08 +00:00
Anastasia.Nekrasova cb4fb15093 Added CONTEXT_RECEIVER_PREFIX to NameUtils for external use
The separate constant is required to support context receiver on the IDE side, see KTIJ-21214
2023-04-04 11:38:34 +00:00
Vladislav Grechko bd7bce9f97 [JVM IR] Get rid of MfvcNodeWithSubnodesImpl class
`MfvcNodeWithSubnodesImpl` has two problems:
- Naming: its name makes one think that the class is inherited from
`MfvcNode` and implements `MfvcNodeWithSubnodes`.However, both
statements are false.
- Semantics: the class only makes unnecessary indirection between its
properties and code of `MfvcNodeWithSubnodes` class
2023-04-04 11:38:15 +00:00
Igor Yakovlev 8102744e00 [Serialization] Fix serialization test data 2023-04-04 11:04:18 +00:00
Igor Yakovlev 81ceb856bb [Serialization] Fix invalid int array creation 2023-04-04 11:04:18 +00:00
Igor Yakovlev 8cb1fca299 [Serialization] Add wasm target platform to serialization plugin 2023-04-04 11:04:17 +00:00
Igor Yakovlev e990c8efd2 [Serialization] Fix invalid ir type for serialize generator 2023-04-04 11:04:17 +00:00
Igor Yakovlev b4d6482581 [Serialization] Fix invalid ir type for deserialize generator 2023-04-04 11:04:17 +00:00
Anna Kozlova 3496f69f33 [cfg] don't traverse annotation arguments for decompiled code
^ KT-57768
decompiled code have no annotation arguments expressions,
but search for them causes decompiling of code
which is slow and unneeded
2023-04-04 10:55:22 +00:00
Kirill Rakhman d6e14f37a7 [FIR] Let FirTopLevelFunctionsChecker run on all platforms
Use a session component to control platform specific suppression logic.
2023-04-04 10:36:40 +00:00
Kirill Rakhman 085df96afe [FIR] Make Volatile diagnostics applicable to kotlin.concurrent.Volatile
#KT-55628 Fixed
2023-04-04 10:36:39 +00:00
Kirill Rakhman 91adb88eff [K1] Make Volatile diagnostics applicable to kotlin.concurrent.Volatile
#KT-55628
2023-04-04 10:36:39 +00:00
Kirill Rakhman e93628d0e6 [Tests] Fix stdlib in common diagnostic tests modules 2023-04-04 10:36:38 +00:00
Pavel Kunyavskiy 09474758ab [K/N] Fix typo in language feature name 2023-04-04 09:13:36 +00:00
nataliya.valtman 6330def427 Fix kotlin compiler arg test plugin's dependencies 2023-04-03 18:03:23 +00:00
Svyatoslav Scherbina cae7f90b59 Bump Kotlin/Native version to 1.9.0-dev-4844 2023-04-03 17:44:40 +00:00
Mikhail Glukhikh d76b32daf2 K1: rename 'kotlinCall' -> 'selectorCall' in relevant places 2023-04-03 16:35:55 +00:00
Mikhail Glukhikh bd27ec840c K1: report swallowed diagnostic about receiver type mismatch
#KT-55056 Fixed
2023-04-03 16:35:55 +00:00
Vladimir Sukharev 176325eaa7 [K2/N] KT-55598: Use InteropBuiltIns only in KonanSymbols and DescriptorsLookup
Merge-request: KT-MR-9431
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-04-03 14:05:43 +00:00
Vladimir Sukharev 23c3d0c36d [K2/N] KT-57716: Workaround by not verifying IR for interop_objc_smoke
Merge-request: KT-MR-9442
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-04-03 14:03:06 +00:00
Leonid Shalupov 7480befe32 Replace reflection-based compiler arguments copying with generated code
Using of Kotlin reflection for simple operations like bean management is very slow

First time initialization time: 261 ms for `copyBean(K2JVMCompilerArguments())`
Subsequent calls of `copyBean(K2JVMCompilerArguments())` take 1.7 ms per call

Unfortunately compiler argument handling is also used in Kotlin IntelliJ plugin
to parse facet settings. Big projects may have thousands of Kotlin facets

The same `ArgumentUtilsKt.copyProperties` frame is seen across various freezes:
IDEA-252440 2-3 minutes freeze on Kotlin project reimporting in last 203 eap
IDEA-253107 A lot of short freezes (1-3 sec) during Kotlin project development
KTIJ-23501 Make main run configuration detection lighter
KTIJ-22435 Unresponsive UI with 100% cpu

Reflection issue:
KT-56358 KClasses.getMemberProperties takes too much time

This commit replaces all reflection stuff with a simple code generation
Now `K2JVMCompilerArguments().clone()` goes to hard-to-measure time
2023-04-03 15:47:35 +02:00
Denis.Zharkov 56557fb8ff K2: Fix generic inference case with !! synthetic call
Result of the `checkNotNull` calls should always be a non-nullable
values.
The simplest idea how to acheive it is adding not-nullable Any bound
to the type parameter declaration.

Existing comment stating about impossibility of such bound seems to be
not 100% correct because it doesn't take into account presence of
definitely-non-nullable X & Any types that allow described case with
nullable generic.

^KT-55804 Fixed
2023-04-03 12:44:52 +00:00
Abduqodiri Qurbonzoda 352316ba9f [K/N] Add @SinceKotlin for ObjC annotations #KT-57197 2023-04-03 12:21:31 +00:00
Dmitriy Novozhilov d7d7620db2 [FIR2IR] Correctly calculate signature for non-dynamic calls on dynamic receiver
If dispatch receiver is dynamic and call on it is not dynamic that means
  that this call was resolved to some specific declaration because of
  smartcast. So we should use original type of this declaration as
  dispatch receiver during calculation of IdSignature instead of Any
  (which came from dynamic type). Otherwise we will have two different
  signatures for the same member declaration

^KT-57682 Fixed
2023-04-03 12:20:01 +00:00
Sebastian Sellmair e3c7241abd [Gradle] ModuleName.orNull: Use predefined 'instrumentedTest'
^KT-56654 Verification Pending
2023-04-03 11:24:21 +00:00
Sebastian Sellmair cdca6da679 [Gradle] KotlinSourceSet.commonizerTarget: Use awaitPlatformCompilations instead of Stage
^KT-56654 Verification Pending
2023-04-03 11:24:21 +00:00
Sebastian Sellmair 8fe444f15e [Gradle] Migrate LenientFuture<T>: Future<T?> to LenientFuture: Future<T>
^KT-56654 Verification Pending
2023-04-03 11:24:21 +00:00
Sebastian Sellmair 262b45405d [Gradle] Change signature of top-level await(Stage) to Stage.await()
^KT-56654 Verification Pending
2023-04-03 11:24:20 +00:00
Sebastian Sellmair 775e08e41d [Gradle] Property.awaitFinalValue: Support generic properties
... even when not declared as lifecycle aware

^KT-56654 Verification Pending
2023-04-03 11:24:20 +00:00
Sebastian Sellmair 2043c9db8e [Gradle] Rename Kotlin~Multiplatfom~PluginLifecycleCoroutineContextElement
^KT-56654 Verification Pending
2023-04-03 11:24:19 +00:00