Commit Graph

3093 Commits

Author SHA1 Message Date
Artem Kobzar cd0ae20c38 [K/JS] Capture stackTrace before the init function call ^Fixed KT-55315 2022-12-20 18:15:02 +00:00
Alexander Korepanov 48daf0befe [JS IR] Take into account file annotations for calculating symbol hashes
^KT-55367 Fixed
2022-12-20 16:04:14 +00:00
Alexander Korepanov 4136189114 [JS IR] Check all signatures of dependent file in IC graph
It is important to check all signatures, because signatures
 can be simultaneously moved between files and modified.
2022-12-20 16:04:14 +00:00
Steven Schäfer 6af616d3c3 FIR: make declarations marked with 'override' implicitly open
#KT-52236 Fixed
2022-12-14 21:46:41 +00:00
Dmitriy Novozhilov 3cffb33ab7 [FE] Drop ApproximateIntegerLiteralTypesInReceiverPosition language feature
This feature is not needed because it is unconditionally disabled for K1
  (because of not fully correct implementation) and unconditionally enabled
  in K2 (K2 does not support old behavior)

^KT-38895
2022-12-09 15:10:02 +00:00
Alexander Korepanov 9edaebf235 [JS IR] Enable DTS generation in IC
^KT-54398 Fixed
2022-12-07 18:05:53 +00:00
Alexander Korepanov d21cbfe02e [JS IR] Take into account the declaration annotations in IC hash
So the annotation modifications invalidate the caller.
2022-12-07 18:05:53 +00:00
Zalim Bashorov fb4dcc6a6a [Sourcemap] Introduce getCurrentColumn and stop using TextOutput directly
The general goal is remove dependency on TextOutput and
make it simpler to use for wasm backend.
2022-12-07 12:03:54 +00:00
Zalim Bashorov e34d3d09bc [Sourcemap] Extract addLink from SourceMap3Builder as a addSourceMappingURL
The general goal is remove dependency on TextOutput and
make it simpler to use for wasm backend.
2022-12-07 12:03:54 +00:00
Alexander Korepanov d8ab9498ab [JS IR] Fix inline functions call graph in IC
Add a dependency for inline function references,
 because in some cases the references may be inlined.

^KT-55144 Fixed
2022-12-02 13:50:37 +00:00
Alexander Korepanov c31705240a [JS IR] Support a module friendship in IC infrastructure
^KT-55097 Fixed
2022-12-02 13:50:36 +00:00
Artem Kobzar 0f0421ea3d [K/JS] Generating TypeScript definitions for exceptions and rest of the types ^Fixed KT-53940 2022-12-01 15:01:24 +00:00
Artem Kobzar 67048151fb [K/JS] Change js-call inlining strategy and + ability to referencethis safely from the js call ^Fixed KT-54134 2022-11-30 11:43:22 +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
Artem Kobzar ad78f27cce [K/JS] Fix problem with dynamic return type inside coroutine 2022-11-23 21:33:56 +00:00
Artem Kobzar 725a224f74 [K/JS] Make available transitive reexport for ES modules 2022-11-18 16:54:10 +00:00
Alexander Korepanov f4b5f5ff5d [JS IR] Take default params into account for calculating an IC hash
^KT-54895 Fixed
2022-11-16 12:25:11 +00:00
Alexander Korepanov f7063555ca [JS IR] Fix the instability of LoweredDeclarationSignature
A suspend stub for the abstract function
 may be created in the context of the child function.
 If on an incremental rebuild the stub is created from
 the parent context (e.g. a file with the child is not modified),
 the resulting LoweredDeclarationSignature will be different.
 It will lead to a broken cross-module reference and broken JS code.
 Therefore it is required to wrap the creation routine
 into StageController::restrictTo() explicitly.

^KT-54934 Fixed
2022-11-16 12:24:48 +00:00
Ilya Chernikov c3197491a0 FIR JS: temporarily mute failing box tests 2022-11-12 16:28:25 +01:00
Ilya Chernikov 78ca733c38 FIR JS: add K2 variants of all other JS tests
except tests that are not possible to add without some modifications in
the test infra. See todos on the commented-out test declarations
2022-11-12 16:28:24 +01:00
Ilya Chernikov 44cce3ad52 FIR JS: mute remaining tests for now 2022-11-12 16:28:23 +01:00
Ilya Chernikov 5b3816cce5 Test infra: refactor IGNORE_BACKEND directive
treat it as a general one, introduce *_K1 and *_K2 variants for
more specific ignoring
2022-11-12 16:28:23 +01:00
Ilya Chernikov e1d19516e8 [minor] fix import statement position in testdata
the import statement is (should be) ignored before FILE directive
2022-11-12 14:34:07 +01:00
Ilya Chernikov fa0cda6236 FIR JS: enable full JS box tests with FIR 2022-11-12 14:34:07 +01:00
Ilya Chernikov 8bf108dc17 FIR JS: Prepare JS/KLib infrastructure for FIR integration
rearrange declarations, abstract things that should be done differently
with FIR, etc.
2022-11-12 14:34:07 +01:00
Zalim Bashorov 31f3fbcd78 [JS, Wasm] Improve readability of the message printed for failed tests for kotlin.test 2022-11-11 16:22:10 +01:00
Sergej Jaskiewicz 7b7c517dbb [JS IR] Emit original names for local vars to sourcemaps
#KT-35655 Fixed
2022-11-09 12:35:44 +00:00
Ilya Goncharov 21991a70e0 [JS] Update npm dependencies in js tests 2022-11-04 15:52:19 +00:00
Sergej Jaskiewicz ba7f5afebe [JS IR] Generate debug info for catch parameters
We will need it to generate original names for catch parameters in
sourcemaps.

Also, don't generate redundant debug info for compiler-generated
exception handling control flow operators.

See the doc comment to the MultipleCatchesLowering class

#KT-46276
2022-11-02 13:14:01 +00:00
Sergej Jaskiewicz 4ae03ea74a [JS IR] Improve debug info for if and when statements
#KT-46276
2022-11-02 13:14:01 +00:00
Sergej Jaskiewicz ccbb2a08a0 [JS IR] Improve debug info for functions with default parameters
Don't generate unnecessary mappings so that the user doesn't need to
step in many times to get where they want

#KT-46276
2022-11-02 13:14:00 +00:00
Sergej Jaskiewicz 43c5c8b44f [JS IR] Fix debug info for Char, Long, and unsigned integer literals
Map class constructor calls to the literals they were generated
from.

#KT-46276
2022-11-02 13:13:59 +00:00
Sergej Jaskiewicz 512a2bfd7a [JS IR] Improve debug info for callable references and lambdas
#KT-46276
2022-11-02 13:13:59 +00:00
Sergej Jaskiewicz b2b7958b62 [JS IR] Generate debug info for secondary constructors
#KT-46276
2022-11-02 13:13:58 +00:00
Sergej Jaskiewicz ec18dce7cb [JS IR] Improve debug info for suspend functions
- Map generated explicit Unit returns to the closing brace of
  the original body
- Name the continuation parameter as `$completion` to match the JVM BE,
  and generate debug info for it (so that it appears in the 'names'
  array in sourcemaps)
- Don't generate debug info for coroutine instantiation ceremony
  (so that the user doesn't need to step in many times to get where they
  want)

#KT-46276
2022-11-02 13:13:58 +00:00
Sergej Jaskiewicz 6a40a7e471 [JS IR] Don't forget to enable lazy property initialization 2022-10-27 11:27:59 +00:00
Alexander Korepanov e2922219f2 [JS IR] Add more JS IC tests for top level properties 2022-10-26 10:54:36 +00:00
Artem Kobzar ea6b784e41 [K/JS] Exclude Enum.entries property from export to JS 2022-10-21 10:31:06 +00:00
Sergej Jaskiewicz a939f9ccd0 [JS IR] Improve debug info precision for blocks
Namely:
- Generate debug info for closing braces, which allows the breakpoints
  set on closing braces to be hit
- Generate debug info for 'if' and 'try/catch' statements.

KT-46276
2022-10-18 14:31:14 +00:00
Alexander Korepanov 901ebcc043 [JS IR] Add JS IR IC tests about companion properties modifications
^KT-54479 Test
2022-10-17 18:59:40 +00:00
Sergej Jaskiewicz d9681caf0c [JS IR] Generate 'names' entries for functions in sourcemaps 2022-10-14 10:09:40 +00:00
Artem Kobzar de880ce9aa [K/JS] Move ES modules logic to a new transformer with IC 2022-10-13 07:32:44 +00:00
Alexander Korepanov 7b2c125754 [JS IR] Update IC depends graph after intrinsics loading
- Remove unused params from compilerWithIC wrapper.
- Move JsIrBackendContext creation logic into separate function
- Introduce and use compiler interface for IC infrastructure

On dirty rebuild we may reload IR from stdlib,
such reloading may affect files with intrinsics and builtins.
As soon as we load only exported symbols, we must track dependencies
for files with intrinsics or builtins as for others.
This patch implements the logic which updates dependencies for
the stdlib files after loading of intrinsics and builtins.

^KT-54323 Fixed
2022-10-12 22:14:15 +00:00
Anton Bannykh 9342356c38 JS IR: fix type checks for suspend function descendants (^KT-54382 fixed)
Consider `class A : suspend () -> Unit {}`. Type checks such as `is A`
are now performed via a regular `instanceof` check instead of the special
checks for suspend lambdas.
2022-10-12 17:38:23 +00:00
Zalim Bashorov 2c889f56fa [K/JS] Add missed JsExport in the test, and uncomment part of it which passes with v8
#KT-41294 Fixed
2022-10-07 19:37:56 +02:00
Artem Kobzar eb2326eabb [K/JS] Add ability to exclude declarations from export by a new annotation @JsExport.Ignore. 2022-10-03 11:07:25 +00:00
Ilya Goncharov 7d8636aac4 [JS] Keep interfaces
^KT-54173 fixed
2022-09-29 16:12:19 +00:00
Alexander Korepanov 252dc01dd5 [JS IR] IC: Propagate dependencies from nested declaration to parent
JsIrLinker can't load nested declarations,
 therefore it is required to load their parent.
 This patch adds a dependency in the incremental cache graph
 between nested declaration user and nested declaration parent.

^KT-53931 Fixed
^KT-54120 Fixed
2022-09-27 15:27:20 +00:00