Commit Graph

99333 Commits

Author SHA1 Message Date
Igor Chevdar ea7c851748 [K/N][IR][codegen] Fixed a number of thread safety problems 2023-03-10 11:05:55 +00:00
Igor Chevdar f442936320 [K/N] Build per-file caches in parallel 2023-03-10 11:05:54 +00:00
Pavel Mikhailovskii 164cbc9968 KTIJ-24768 Fix IllegalArgumentException in KtType.isPrimitiveBacked 2023-03-10 11:03:45 +00:00
Yan Zhulanow 8d1cfe0017 [LL API] Allow multiple candidates for non-local callables (KTIJ-21108)
In a combined classpath, such as scripting classpath for the whole
project, there might be several versions of the same library.
2023-03-10 10:59:01 +00:00
Pavel Mikhailovskii d9f023db89 KT-56845 [SLC] Add @Override to overridden property accessors 2023-03-10 10:32:48 +00:00
Mikhail Zarechenskiy 82524fde26 K1: Place integer cinterop conversions under a language feature
Note that it's quite hard to emit a particular diagnostic as
 type check happens later, after the conversion

 ^KT-56583
2023-03-10 09:48:01 +00:00
Alexander Korepanov 2cad26f4cc [JS IR] Use cacheable ZIP file system accessor in JS IR BE
Related to KT-51712
2023-03-10 09:38:52 +00:00
Alexander Korepanov 8f22d6d36e [KLIB] Add a cacheable ZIP file system accessor
Creating a ZipFileSystem object is an expensive operation.
 A cacheable ZIP file system accessor caches ZipFileSystem
 objects and may improve the performance of the in place
 metadata reading operations from klibs.

Related to KT-51712
2023-03-10 09:38:52 +00:00
Alexander Korepanov e4406638bd [KLIB] Add ZIP file system accessor
The accessor interface is used for reading klib archives in place.
2023-03-10 09:38:51 +00:00
Sergey Bogolepov af1f3a102b [K/N] Disable split_compilation_pipeline for MinGW 2023-03-10 09:31:41 +00:00
Sergey Bogolepov 236cf2b9ca [K/N] Disable split_compilation_pipeline in two-stage mode
There is no way to pass flags only to the second stage in tests.
2023-03-10 09:31:41 +00:00
Sergey Bogolepov bba7e9e395 [K/N] Prohibit -Xcompile-from-bitcode when producing library 2023-03-10 09:31:40 +00:00
Kirill Rakhman 0e721c8fc2 [FIR2IR] Fix generation of val initialization after smart-cast
If neither setter nor backing field were found for an assignment call,
search overridden properties for backing fields.

^KT-57105 Fixed
2023-03-10 09:30:51 +00:00
Kirill Rakhman 2706e5502f [Tests] Add IR text tests for KT-57105 2023-03-10 09:30:51 +00:00
Vladimir Sukharev 6964121c15 [K2/N] KT-57026, KT-57208: Adjust Native & JS test infrastructures for MPP testing
Merge-request: KT-MR-9081
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-03-09 18:56:30 +00:00
Marco Pennekamp d0782cb5a5 [AA] KT-56617 Remove isValidityAssertion from internal properties of KtFirPsiJavaClassSymbol 2023-03-09 18:36:00 +00:00
Marco Pennekamp 037984b0e0 [AA] KT-56617 Introduce PSI-based Java type parameter symbols
- Instead of extending the API with `typeParameterNames`, this commit
  creates a PSI-based Java type parameter symbol similarly to the
  PSI-based Java class symbol. Because completion requires only the type
  parameter name, this approach works fine, and without exposing an
  optimization via the API.
2023-03-09 18:36:00 +00:00
Marco Pennekamp 1e43e8d975 [AA] KT-56617 Introduce shared equals/hashCode for class symbols
- Instead of spreading `equals` and `hashCode` implementations over
  `KtFirNamedClassOrObjectSymbol` and `KtFirPsiJavaClassSymbol`, this
  commit introduces a shared base class.
2023-03-09 18:35:59 +00:00
Marco Pennekamp c729435765 [AA] KT-56617 Sync hashCode/equals of Java and regular class symbols
- Some completion tests failed because the `hashCode` of
  `KtFirNamedClassOrObjectSymbol` and `KtFirPsiJavaClassSymbol` was
  different for symbols which should be equal. Both symbols now use the
  `ClassId` hash code.
- `KtFirNamedClassOrObjectSymbol.equals` is now properly symmetric with
  `KtFirPsiJavaClassSymbol`.
- `KtFirPsiJavaClassSymbol` now has a definite class ID, which
  simplifies its implementation a little. `KtFirPsiJavaClassSymbol`
  doesn't support local Java classes by design.
2023-03-09 18:35:59 +00:00
Marco Pennekamp f9fb718b37 [AA] KT-56617 Optimize deprecation calculation for Java class symbols
- Most Java classes aren't deprecated. To avoid building `firSymbol`
  in such cases, this commit adds a simple heuristic which checks the
  class's annotations for the presence of one of the deprecation
  annotations recognized by the Kotlin compiler.
- Note that annotations are compared via simple names, so there is a
  slight margin of error. However, comparing class IDs is more costly in
  my tests, because getting an annotation's class ID is not as cheap as
  getting its simple name.
2023-03-09 18:35:59 +00:00
Marco Pennekamp d5933f28ab [AA] KT-56617 Optimize type parameter access for Java class symbols
- Completion accesses symbol type parameters to render their names.
  Instead of building the whole list of type parameters, and
  consequently the whole FIR class, completion can now access the type
  parameter names directly.
2023-03-09 18:35:58 +00:00
Marco Pennekamp 77e374db77 [AA] KT-56617 Optimize KtFirVisibilityChecker for Java class symbols
- `KtFirVisibilityChecker` accessed `KtFirPsiJavaClassSymbol.firSymbol`
  a significant number of times during completion, which led to many
  instances of FIR class construction.
- This commit introduces a heuristic to `KtFirVisibilityChecker`
  specifically for `KtFirPsiJavaClassSymbol` to bypass the compiler's
  visibility checker. The fact that we're dealing with Java class
  visibility from Kotlin makes this feasible without reimplementing the
  full logic of `FirVisibilityChecker`.
2023-03-09 18:35:58 +00:00
Marco Pennekamp 26e2c48a46 [AA] KT-56617 Implement equals/hashCode without accessing firSymbol 2023-03-09 18:35:57 +00:00
Marco Pennekamp 46d443770e [AA] KT-56617 Don't defer to firSymbol for empty annotation lists
- `FirJavaClass` gets all its annotations from the Java annotations, so
  we can rely on `javaClass.annotations` to determine if any annotations
  are present.
2023-03-09 18:35:57 +00:00
Marco Pennekamp 0b98192cb0 [AA] Fix exception message in withFirForScope
- We should not pass a lambda to `error`, as the exception message is
  `() -> kotlin.String` then.
2023-03-09 18:35:57 +00:00
Marco Pennekamp 1c46d37663 [AA] KT-56617 Build FirClassSymbols for Java classes lazily
- Some completion performance tests (e.g. IntelliJ: "empty place typing
  with library cache") spent a considerable amount of time in
  `KtFirSymbolProviderByJavaPsi.getNamedClassSymbol`.
- This commit introduces `KtFirPsiJavaClassSymbol`, which implements
  many `KtNamedClassOrObjectSymbol` properties with the `PsiClass`
  instead of the FIR class. The `FirClassSymbol` is built only when
  necessary. This improves performance when no "slow" properties need to
  be computed for the symbol.

^KT-56617 fixed
2023-03-09 18:35:56 +00:00
Marco Pennekamp e70a3a899f [AA] Move classIdIfNonLocal to analysis-internal-utils
- The utility will be needed by a `KtFir*Symbol` class.
2023-03-09 18:35:56 +00:00
Marco Pennekamp 9cc6809ec6 [FIR] Fix JavaClass.modality for annotation classes and enums
- `JavaClass.modality` should return the correct modality instead of
  requiring the caller to handle annotation classes and enums.
2023-03-09 18:35:56 +00:00
Artem Kobzar 484e5afb59 [K/JS] Remove unused Unit_getInstance import into generated code 2023-03-09 16:51:07 +00:00
Roman Efremov 60787e9fe4 Add ability to override EnumEntries class search logic from IDE side
See KTIJ-24676
2023-03-09 14:01:10 +00:00
Aleksei.Cherepanov 6471624d0c [Gradle] Disable usePreciseJavaTracking flag for K2
Historically flag was enabled for Gradle projects, but we don't have fir-based JavaTracker for the K2 compiler for now, so we need to use a fallback strategy.
Note: it was disabled for tests with K2
Note2: after adding a fir-based java classes tracker this value should be set to true (KT-57147)

#KT-56886 Fixed

Merge-request: KT-MR-9053
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
2023-03-09 13:41:25 +00:00
Kirill Rakhman d7880eb12c [FIR] Refactor SpecificityComparisonWithNumerics 2023-03-09 13:00:54 +00:00
Kirill Rakhman fa432d7f0d [FIR] Prioritize double over float in overload resolution
#KT-57194 Fixed
2023-03-09 13:00:53 +00:00
Svyatoslav Kuzmich 525317962c [Wasm] Test js(code) with vararg parameter 2023-03-09 12:50:14 +00:00
Svyatoslav Kuzmich d5b958f744 [Wasm] Support default parameter values in functions with js(code) 2023-03-09 12:50:14 +00:00
Dmitriy Novozhilov d5e6102ed9 [FIR] Properly check is some setter function is applicable for synthetic property
^KT-56506 Fixed
2023-03-09 12:32:49 +00:00
Yahor Berdnikau ce39a02e0a Unify Kotlin daemon JVM arguments settings in Kotlin repo
Now 'kotlin-daemon-config' convention plugin should be added into
settings plugins to configure Kotlin daemon.
2023-03-09 10:16:05 +00:00
Yahor Berdnikau b9d19a864a Unify Kotlin daemon JVM arguments settings in Kotlin repo
Now 'kotlin-daemon-config' convention plugin should be added into
settings plugins to configure Kotlin daemon.
2023-03-09 10:16:05 +00:00
Yahor Berdnikau c080765905 Add missing file encoding setting to buildSrc properties 2023-03-09 10:16:04 +00:00
Nikolay Lunyak f39467b4ba [FIR] KT-57175: Expand typealiases in the annotation class checker
^KT-57175 Fixed
2023-03-09 09:44:09 +00:00
Nikolay Lunyak 5cbe699fc4 [FIR] KT-56876: Ensure inner type classifiers are resolved in contracts
^KT-56876 Fixed
2023-03-09 09:43:03 +00:00
Nikolay Lunyak c156dfe855 [FIR] KT-56877: Allow checking types of containing classes in contracts 2023-03-09 09:43:03 +00:00
Nikolay Lunyak c7a71fec17 [FIR] KT-56877: Allow referencing implicit receivers in class contracts 2023-03-09 09:43:02 +00:00
Nikolay Lunyak 409249267c [FIR] Ensure this@label doesn't work in K2 2023-03-09 09:43:02 +00:00
Nikita Bobko 62d2327ca3 Don't issue a warning about expect/actual in the same module for incompatible expect/actual pairs
^KT-57067 Fixed
Review: https://jetbrains.team/p/kt/reviews/9123
2023-03-09 09:30:29 +00:00
aleksandrina-streltsova 3d0bca5ca1 [Analysis API] Handle missed cases in PsiElement.getExpectedType()
^KTIJ-24256
2023-03-09 09:19:00 +00:00
Pavel Kirpichenkov 7dd438cb9e [MPP] KGP dependency resolution: JVM stdlib for JVM+Android source sets
KTIJ-24701
2023-03-09 09:10:42 +00:00
Pavel Kirpichenkov 0c33e89c02 Extract Kotlin stdlib Gradle module constants in dependency management
KTIJ-24701
2023-03-09 09:10:42 +00:00
Mikhail Glukhikh af78ef77b4 K2: don't accept reflective function kinds as possible lambda type
#KT-56954 Fixed
2023-03-09 08:52:46 +00:00
Mikhail Glukhikh 7a6ff5de34 K2: add test for KT-56954 2023-03-09 08:52:46 +00:00