Commit Graph

41560 Commits

Author SHA1 Message Date
Ilya Kirillov bba5b87733 Fix binary compatibility with org.jetbrains.kotlin.descriptors.explicitParameters 2022-11-29 21:52:56 +00:00
Jinseong Jeon 8eccb552a3 Migrate descriptor-related util from IR to FE1.0
so that FE1.0 UAST can avoid depending on backend IR

^KTIJ-23602
2022-11-29 21:52:55 +00:00
Vladimir Dolzhenko f54e7abe1d Reduce memory footprint
#KTIJ-23785
2022-11-29 21:01:43 +00:00
Marco Pennekamp d4e6a4ad54 [FIR] KT-54978 Prohibit explicit type arguments in property accesses
- Add a checker which ensures that property accesses have no explicit
  type arguments. If an error on the property access's callee reference
  already exists, the new error is not reported in favor of the existing
  error, as the property access may have been intended to be a function
  call.
- `complicatedLTGT.fir.kt`: The underlying parser issue is not yet
  solved, which is why `x` is parsed as a property access with explicit
  type arguments.
- `reservedExpressionSyntax` tests: This new check makes a lot of the
  access expressions in these tests illegal, so valid lines have been
  added and invalid lines appropriately marked with
  `EXPLICIT_TYPE_ARGUMENTS_IN_PROPERTY_ACCESS` errors.

^KT-54978 fixed
2022-11-29 14:47:59 +00:00
Dmitrii Gridin 37729c0353 [SLC] migrate SymbolLightParameterForReceiver to KtReceiverParameterSymbol
^KT-54051
2022-11-29 13:33:43 +00:00
Dmitrii Gridin a7fae5fd99 [SLC] SymbolLightClassForEnumEntry: improve implementation
^KT-54051
^KT-50241
2022-11-29 13:33:35 +00:00
Dmitrii Gridin a539203e73 [SLC] drop KtAnalysisSession from SymbolLightClassBase
^KT-54051
2022-11-29 13:33:33 +00:00
Dmitriy Novozhilov 46928eaa0b [FIR] Unconditionally enable BooleanElvisBoundSmartCasts feature in K2
^KT-54694 Fixed
^KT-26357
2022-11-29 12:25:45 +00:00
Dmitriy Novozhilov ac7fddaad5 [FE] Always infer upper types to intersection types in K2...
...and always use old algorithm for K1

^KT-51221
2022-11-29 12:25:44 +00:00
Sergej Jaskiewicz d50c072af0 [klib] Validate paths when unpacking zip archives 2022-11-29 12:21:04 +00:00
Mads Ager 30002e29d1 [KAPT+JVM_IR] Do not generate initializers for delegated properties.
^KT-54870 Fixed
2022-11-28 22:27:09 +01:00
Alexander Korepanov 9dab8637a8 [JS Gradle] Pass incremental cache root dir to K2JS compiler 2022-11-28 20:46:40 +00:00
Alexander Korepanov 693258ae91 [JS IR] Invalidate all klib dependencies after removing it
Without the invalidation, broken JS code
 (with broken cross-module references) may appear.

 ^KT-54911 Fixed
2022-11-28 20:46:40 +00:00
Alexander Korepanov ca19d71a00 [JS IR] Commit cache header after lowering
Commiting cache header before lowering may
 break caches in case of lowering errors.

^KT-54912 Fixed
2022-11-28 20:46:40 +00:00
Alexander Korepanov 8cde0a81bc [JS IR] Use topological order for loading klibs in JS IR IC
Generally, the library order doesn't matter.

 However, after lowering we need to post process
 lowered klibs in topological order:
  - commit incremental cache artifacts,
  - produce JS AST.

 The patch uses an ability of the Kotlin library resolver to load klibs
 in topological order and drops its reimplementation from IC infrastructure.

 There is one side effect:
   klibs which are not reachable from the main module, will produce their JS.
   This should be more correct than just ignoring them.
2022-11-28 20:46:39 +00:00
Alexander Korepanov ec6a7094e6 [JS IR] Manage cache root dir from IC cache updater
- pass cache root directory instead of dir list
 - manage klib cache dirs from cache updater
2022-11-28 20:46:39 +00:00
Alexander Korepanov c7589245c4 [JS IR] Minor IC refactoring
Move metadata classes from cache updater to separate file.
2022-11-28 20:46:38 +00:00
Mikhail Glukhikh 8ffabddf75 FIR2IR: cleanup field static fake override caching 2022-11-28 17:27:51 +00:00
Mikhail Glukhikh 91a3c78844 Fir2IrDeclarationStorage: drop redundant 'with' + fix formatting 2022-11-28 17:27:51 +00:00
Mikhail Glukhikh 237f357016 FIR: don't copy initializer for field override, unwrap it instead 2022-11-28 17:27:50 +00:00
Mikhail Glukhikh c698d060c6 FIR2IR: support static fake overrides for fields (related to KT-53441)
#KT-54921 Fixed
2022-11-28 17:27:50 +00:00
Sergej Jaskiewicz aa1b18b0c8 [IR] Prevent infinite recursion when rendering bound symbol references
Refactor the renderer, make BoundSymbolReferenceRenderer a static class
to prevent calling RenderIrElementVisitor's methods from it to avoid
infinite recursion in the future.

^KT-52677 Fixed
2022-11-28 16:43:53 +00:00
Vladimir Dolzhenko af08e4121d Fix fragment element types class hierarchy.
They must not extend `IStubFileElementType`.

#KT-55160 Fixed
2022-11-28 15:44:37 +00:00
Vladimir Dolzhenko e751b11b5e Add extra checks
#EA-721785
2022-11-28 15:20:29 +00:00
Ilya Chernikov e4a361a4b4 K2 Scripting: disable scripts in source roots by default
fixes ultimate FP test
2022-11-28 15:10:55 +00:00
Pavel Kunyavskiy 09518a457a Better unbound symbols support for dumpKotlinLike
If there is an unbound symbols in IrTree near backend exception,
compiler failed again during processing an error.

It led to hard-understandable error. Now at least it would show
problematic part of code, which is better for making workarounds.

^KT-55088
2022-11-28 14:22:46 +00:00
Ilya Chernikov 4af32b8d36 K2 Scripting, IR: non-class based scripts support in IR 2022-11-26 18:01:49 +00:00
Ilya Chernikov cc9a7480a2 K2 Scripting: add FIR2IR conversion for FirScript 2022-11-26 18:01:49 +00:00
Ilya Chernikov 47448d779c K2 Scripting: enable script diagnostic tests for FIR
also add script scopes test
2022-11-26 18:01:49 +00:00
Ilya Chernikov a3a1550933 K2 scripting: add initial scripting support to K2 frontend 2022-11-26 18:01:48 +00:00
Evgeniy.Zhelenskiy 002f6bd34a [FIR] Fix JvmName annotation diagnostics
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-55143
2022-11-25 16:30:22 +01:00
Zalim Bashorov 7f8f7aa050 [Wasm] Revert ref cast and test instructions to be compatible with Binaryen 2022-11-25 15:31:48 +01:00
Zalim Bashorov 5f140dac21 [Wasm] Remove wasm_ref_cast and use wasm_ref_cast_null inside the compiler 2022-11-25 15:31:47 +01:00
Zalim Bashorov e7d0e451e7 [Wasm] Fix immediate type for recently (in M6) introduced instructions
STRUCT_TYPE_IDX -> HEAP_TYPE
WasmImmediate.TypeIdx -> WasmImmediate.HeapType
2022-11-25 15:31:47 +01:00
Anna Kozlova abb45a0728 [AA] don't treat incomplete function as anonymous
^KTIJ-23672
sync anonymous function predicate with RawFirBuilder/DeclarationsConverter
2022-11-25 14:27:03 +00:00
Egor Kulikov d585f068dd [FIR] Make anonymous initializer lazy in RawFirBuilder
Fourth step for KT-52615

Merge-request: KT-MR-7798
Merged-by: Egor Kulikov <Egor.Kulikov@jetbrains.com>
2022-11-25 11:41:44 +00:00
Nikolay Lunyak a454d42e65 [FIR] KT-54587: Report the missing diagnostics
^KT-54587 Fixed

Merge-request: KT-MR-7791
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2022-11-25 10:19:58 +00:00
Nikolay Lunyak 7147b7d17b [FIR] KT-55033: Split runTransaction into smaller functions
^KT-55033 Fixed

Merge-request: KT-MR-7779
Merged-by: Nikolay Lunyak <Nikolay.Lunyak@jetbrains.com>
2022-11-25 09:12:15 +00:00
vladislav.grechko 50e92d2238 Add null checks in constructors taking value class types
^KT-53492: Fixed
2022-11-24 20:12:05 +00:00
Vladislav Grechko cd6e865fb3 Improve support of 'lateinit' modifier
- Allow 'lateinit' for inline classes which underlying type
is suitable for 'lateinit'

- K2: report all problems related to 'lateinit' modifier

^KT-55052: Fixed
2022-11-24 19:47:21 +00:00
vladislav.grechko e0c13e5276 Fix addAll & putAll invocations on inline mutable collections
^KT-54950: Fixed
2022-11-24 19:27:42 +00:00
Dmitrii Gridin 3bc9299b3b [FIR] SignatureEnhancement: drop redundant 'resolvePhase' for type parameter
^KT-54826
2022-11-24 18:32:45 +00:00
Dmitrii Gridin ec613e57ef [FIR] add Enhancement wrapping for type parameters
^KT-55095 Fixed
2022-11-24 18:32:43 +00:00
Dmitrii Gridin 2155a23e4e [AA FIR] implement FirCallableSignature to simplify search by signature
^KT-54826 Fixed
2022-11-24 18:32:43 +00:00
Denis.Zharkov ca12cfb90d K2: Do not fix variables that has yet unprocessed constraints in forks
Otherwise, exception from org.jetbrains.kotlin.resolve.calls.inference.components.ConstraintInjector.TypeCheckerStateForConstraintInjector.fixedTypeVariable
might happen during forks resolution

The test data is extracted from intelliJ FP test

^KT-43296 Fixed
2022-11-24 17:29:30 +00:00
Denis.Zharkov b73acd7a3a K2: Apply constraints from forks at UNTIL_FIRST_LAMBDA completion phase
Otherwise, OVERLOAD_RESOLUTION_AMBIGUITY is reported for the calls to
the functions annotated as @OverloadResolutionByLambdaReturnType

^KT-43296 In Progress
2022-11-24 17:29:29 +00:00
Denis.Zharkov 10d63cc52a K2: Postpone inference forks resolution until FULL completion
It helps to use expected type information when choosing the branch
even in the nested calls

^KT-43296 In Progress
2022-11-24 17:29:29 +00:00
Denis.Zharkov c958c79362 Minor cleanup at ConstraintInjector.kt 2022-11-24 17:29:29 +00:00
Denis.Zharkov 02b2927921 Clarify naming around inference fork points
^KT-43296 In Progress
2022-11-24 17:29:28 +00:00
Denis.Zharkov 715a73c8fb K2: Support inference case with a mix of smart-cast and expected type
The idea is that we should not fix (i.e. choose any of the fork branches)
on the stage of candidate processing before completion, but it's enough
just to check that current state can be converged to success.

And when completion starts, and we add expected type to the system,
we've got more information to choose the correct fork branch.

NB: The old `processForkConstraints` is being called just
at the beginning of the completion phase.

^KT-43296 In Progress
2022-11-24 17:29:28 +00:00