Commit Graph

99239 Commits

Author SHA1 Message Date
Alexander.Likhachev 2bff38dd27 [IC] Fix transaction wasn't marked as unsuccessful on execution exception
#KT-56052 In Progress
2023-03-07 16:19:22 +00:00
Alexander.Likhachev 8825cf7bf6 [IC] Fix RecoverableCompilationTransaction wasn't throwing an exception properly
#KT-56052 In Progress
2023-03-07 16:19:22 +00:00
Alexander.Likhachev 83ea1ca3cf [IC] Let CompilationTransaction to reset in-memory changes in IC caches
#KT-56052 In Progress
2023-03-07 16:19:22 +00:00
Alexander.Likhachev 493da2a8b4 [IC] Rename DummyCompilationTransaction -> NonRecoverableCompilationTransaction 2023-03-07 16:19:21 +00:00
Alexander.Likhachev 25a3dcf3d1 [IC] Make CompilationTransaction to be able to close CachesManager 2023-03-07 16:19:21 +00:00
Alexander.Likhachev 3ed651a7a6 [Gradle] Add a property to control if the IC caches in-memory wrapper is enabled
#KT-56052 In Progress
2023-03-07 16:19:20 +00:00
Alexander.Likhachev e7e5a3488b [IC] Introduce a wrapper for IC caches storage to keep changes in-memory
#KT-56052 In Progress
2023-03-07 16:19:20 +00:00
Vladimir Sukharev 8dc6ae41f6 Exclude 3 KonanDriverTest testcases from K2 testing due to KT-56855
Merge-request: KT-MR-9114
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-03-07 14:05:12 +00:00
Oleg Yukhnevich dddd5a57c5 fix api dumpp 2023-03-07 13:57:35 +01:00
Oleg Yukhnevich 3726bf0ed5 replace KDoc comment with simple one 2023-03-07 13:57:35 +01:00
Oleg Yukhnevich 3f8f25fe43 move ExperimentalWasmDsl opt-in to file level 2023-03-07 13:57:35 +01:00
Oleg Yukhnevich b240b8452a support WASM in KotlinTargetHierarchyBuilder 2023-03-07 13:57:35 +01:00
Marco Pennekamp 91fb16110f [FIR] KTIJ-24296 Remove unused isNameForFunctionClass 2023-03-07 11:44:15 +00:00
Marco Pennekamp eb673e4566 [FIR] KTIJ-24296 Optimize isNameForFunctionClass based on name shape
- A `classId` can only be a generated function class if it ends with a
  digit, per the contract described in `FunctionTypeKind`.
- The optimization uses this fact to avoid calling
  `functionTypeService.getKindByClassNamePrefix`, which can be expensive
  due to a hash map access.
2023-03-07 11:44:14 +00:00
Marco Pennekamp a725fe559c [FIR] KTIJ-24296 Allow special names in symbol provider pre-filtering
- A special name such as `<no name provided>` may not be contained in
  the list of names, but may still be found by a provider.
2023-03-07 11:44:14 +00:00
Marco Pennekamp ece038b49b [LL FIR] KTIJ-24296 Extract symbol provider name cache into a class
- The caching logic from `LLFirProvider` may be used in other symbol
  providers.
2023-03-07 11:44:14 +00:00
Marco Pennekamp d9a024bab2 [LL FIR] KTIJ-24296 Implement symbol name pre-filtering in LLFirProvider
- The optimization reduces time spent in `LLFirProvider.SymbolProvider`
  during my tests by 30-90% in some highlighted files. In other
  performance tests, the optimization makes performance worse, so more
  work is needed. In general, higher workload tests run faster with the
  optimization, while lower workload tests run slower. This is expected
  as the optimization trades short-term performance (for building
  classifier/callable name sets) in favor of long-term speedup.
- The changes should also reduce the size of declaration caches like
  `LLFirProviderHelper.classifierByClassId`.
- Building the name sets has a second use, as a similar optimization can
  be implemented for dependent module providers, which may rely on the
  sets computed here.
2023-03-07 11:44:13 +00:00
Marco Pennekamp 18ce21fb13 [FIR] Extract mayHaveTopLevelClassifier from composite symbol provider
- The implementation is not trivial and should be usable in other symbol
  providers.
2023-03-07 11:44:13 +00:00
Nikolay Lunyak 343deeec1c [FIR] Check FirReceiverParameter annotations' targets 2023-03-07 11:35:47 +00:00
Nikolay Lunyak 0c77de3049 [FIR] Add a test with an inapplicable receiver annotation 2023-03-07 11:35:47 +00:00
Nikolay Lunyak 1378d730d6 [FIR] Forbid all use-site targets of FirTypeRef annotations 2023-03-07 11:35:47 +00:00
Nikolay Lunyak 93ba0c3e70 [FIR] KT-56769: Ensure @receiver: is only allowed on receivers
Note that there's no code that checks that
FirReceiverParameter's annotation's use-site target
is indeed `@receiver:`, because otherwise the
annotation wouldn't have made it into
the FirReceiverParameter.

In contrast, in K1 all such annotations are treated
as annotations on a KtTypeReference.

^KT-56769 Fixed
2023-03-07 11:35:46 +00:00
Yahor Berdnikau 174f39aa46 Add '-opt-in' option into Gradle compiler options DSL
^KT-53924 Fixed
2023-03-07 09:40:09 +00:00
Pavel Kunyavskiy 2b4abb0c7b [K/N] Remove outdated boxing related functions and classes
^KT-55765
2023-03-07 08:51:00 +00:00
Zalim Bashorov 4d7cf81ed0 [Wasm] Stop supporting "_export.js" in test infra, use import/export capability in relevant tests
* It works slightly differently in SpiderMonkey.
* It was a hack.
2023-03-06 23:19:02 +01:00
Zalim Bashorov bec827b654 [Wasm] Update SpiderMonkey to 112.0a1 (2023-03-04-09-52-24) 2023-03-06 23:19:02 +01:00
Alexander Udalov 47c48efa33 JVM IR: do not generate extension receiver parameter as ACC_MANDATED
Otherwise Java reflection is not able to load its type as a
parameterized type.

 #KT-40857 Fixed
2023-03-06 20:57:52 +00:00
Sebastian Sellmair d23a4f46cc [Gradle] Split Tasks.kt into several source files (per class) (2/2)
^KT-57142 Verification Pending
2023-03-06 18:19:12 +00:00
Sebastian Sellmair 02ac54fe5f [Gradle] Split Tasks.kt into several source files (per class) (1/2)
^KT-57142 Verification Pending
2023-03-06 18:19:11 +00:00
Yan Zhulanow 0044f49af8 Revert "[LL API] Fix vararg parameter matching in PSI-FIR comparison"
This reverts commit 2d8c3c5aaf.
2023-03-07 02:49:41 +09:00
Yan Zhulanow 07fdbeca19 [LL API] Search declarations in dependencies as a fallback
'JvmClassFileBasedSymbolProvider' works incorrectly for some cases,
such as built-in classes. Moreover, the whole declaration binding logic
looks over-complicated and redundant, as we get a 'ClassId'/'CallableId'
from a 'KtDeclaration', and look for it again in indices.

This commit fixes a bunch of failing completion tests:
- HighLevelJvmBasicCompletionTestGenerated
- HighLevelMultiFileJvmBasicCompletionTestGenerated
- FirKeywordCompletionHandlerTestGenerated
2023-03-06 17:49:16 +00:00
Yan Zhulanow 342488e66e [LL API] Restrict accepted declarations for on-air resolution
After 1cfd2ae7ff, all non-local
declarations became targets for on-air resolution. However, some of
them, including secondary constructors, are not supposed to be used
in that way. The commit restores the previous behavior.

This commits fixes failing tests in the following groups:
- FirIdeDependentAnalysisSourceModuleIsUsedAsExpressionTestGenerated
- FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated
- FirOnAirResolveTestGenerated
2023-03-06 17:49:16 +00:00
Artem Kobzar 26f6661d1e [K/JS] Remove the possibility to have negative lines and columns in Source Maps 2023-03-06 16:55:26 +00:00
Pavel Kunyavskiy f2c1145462 [K/N] Disable failing test on mips, target is deprecated 2023-03-06 11:56:10 +00:00
Kirill Rakhman b80970b09f [FIR] Fix references to generic synthetic properties
When synthetic properties are built from a substitution override,
set originalForSubstitutionOverride, too.

^KT-56251 Fixed
2023-03-06 09:45:02 +00:00
Yan Zhulanow 37760d1f2a [Analysis API] Support script declarations (KTIJ-21108) 2023-03-05 19:18:21 +00:00
Yan Zhulanow e5e0575ab0 [LL API] Avoid dependencies in compiled element searcher
Library modules depend on all other project modules. Such a
simplification is useful for cross-library analysis. However, this
seems to be rather harmful for PSI->FIR binding as there might be
several versions of the same library in a project.
2023-03-05 19:18:20 +00:00
Yan Zhulanow 2d8c3c5aaf [LL API] Fix vararg parameter matching in PSI-FIR comparison 2023-03-05 19:18:20 +00:00
Yan Zhulanow 8b1be89507 [LL API] Check raw expect/actual modifiers in PSI-FIR comparison
There might be both common and JVM artifacts of the same library
in dependencies.
2023-03-05 19:18:20 +00:00
Yan Zhulanow 1cfd2ae7ff [LL API] Fix on-air analysis for scripts (KTIJ-21108)
The implementation is rather limited. Advanced cases, such as
replacing a script with another one with different import directives,
won't work because of non-trivial relationship between 'FirFile' and
'FirScript'.
2023-03-05 19:18:19 +00:00
Yan Zhulanow ae40ddcf03 [LL API] Provide basic support for scripts in K2 (KTIJ-21108) 2023-03-05 19:18:19 +00:00
Sergey Bogolepov ca7d1d0194 [K/N] Minor -Xcompile-from-bitcode enhancements 2023-03-04 16:13:43 +00:00
Johan Bay 349a6b6e82 Introduce flag for bitcode to native compilation
This enables splitting the compilation pipeline into multiple
invocations of the compiler.
2023-03-04 16:13:42 +00:00
vladislav.grechko 7033d78641 Fix SAM conversion generation condition
Remove check if array is passed to vararg parameter as it's not
relevant anymore and leads to ^KT-51821.

^KT-51821: Fixed
2023-03-04 12:53:48 +00:00
Yan Zhulanow c604577132 Embed DefaultErrorMessages extension list (KT-57102)
Normally, 'DefaultErrorMessages' extensions should only be loaded
from the main compiler JAR. However, in the in-process JPS build,
there are two versions of the compiler classes in the process, and
'ClassLoader's there are not fully isolated.

'ServiceManager' loads extensions from both 'META-INF' locations. If
the JPS plugin bundles newer compiler components, newly appeared
'DefaultErrorMessages' extensions will be loaded from the JPS (parent)
'ClassLoader', causing an exception.

Such a problem appeared with 'DefaultErrorMessagesWasm':

- - - - -
java.util.ServiceConfigurationError:
org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages$Extension: org.jetbrains.kotlin.wasm.resolve.diagnostics.DefaultErrorMessagesWasm not a subtype
- - - - -
2023-03-04 06:38:34 +00:00
Sergej Jaskiewicz f40278c036 An option to allow out-of-scope type parameters in IrManglerComputer
In the lowered IR there are often references to type parameters whose
containers are not in the current scope. This is incorrect semantically,
but it works in practice due to erasure, so when the mangler is used on
the lowered IR, we don't want to crash the compiler.
2023-03-03 22:08:57 +00:00
Sergej Jaskiewicz e3a4d6fa56 Use star-projected types for building ScriptProvidedPropertyDescriptors
Otherwise, the type parameters of the `kotlin.script.state` property
of type `AggregatedReplStageState` were undefined, which led to
building an ill-formed signature for the script class constructor.
2023-03-03 22:08:57 +00:00
Sergej Jaskiewicz 27adfa8370 [FIR] Provide the correct type parameters when building arrayOf function 2023-03-03 22:08:56 +00:00
Sergej Jaskiewicz 88e244c1cf [IR] Remove JS-specific manglers, as they don't customize any behavior 2023-03-03 22:08:56 +00:00
Sergej Jaskiewicz 1651199ed8 [IR] Add doc comments for KotlinMangleComputer and its inheritors 2023-03-03 22:08:56 +00:00