Commit Graph

3629 Commits

Author SHA1 Message Date
Svyatoslav Kuzmich dd53998c2d [Wasm] Add uninstantiated MJS wrapper
It allows

* Custom imports
* Ability to skip initializer
2022-12-28 12:13:52 +01:00
Svyatoslav Kuzmich 3bbd8c291a [Wasm] Add @WasmImport annotation
Imports top-level function from given module
2022-12-28 12:13:18 +01:00
Vyacheslav Gerasimov 719cdce609 Build: Make mochaTest a VerificationTask to allow skipping it with flag
#KTI-1076
2022-12-22 18:45:41 +01:00
Vyacheslav Gerasimov 7348e34fd0 Build: Run only jsTests before mocha tests
Only js tests produce mocha tests to run
2022-12-22 18:45:40 +01:00
Svyatoslav Kuzmich d788adcbb5 [Wasm] Move non-recursive function types out of rec group
This fixes linking with other wasm modules with non-rec types
2022-12-21 20:20:13 +00:00
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
Igor Chevdar 0f2ebeea15 [tests] Added a test for KT-55494 2022-12-16 18:32:42 +00:00
Sergej Jaskiewicz 9c6f92d697 [test] Add a test for KT-55318 2022-12-13 17:01:00 +00:00
Evgeniy.Zhelenskiy f09fb5ed09 [IR] Enable tests for inline classes secondary constructors with body for not JVM
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-55333
2022-12-11 22:06:47 +01:00
Vyacheslav Gerasimov ba81bd052f Build: Include missing tests in jsTest, jsIrTest, jsFirTest tasks
Some tests were included only in common :js:js.tests:test task and
 missing in specialized test tasks (jsTest, jsIrTest, jsFirTest)
2022-12-09 20:42:08 +01:00
Vyacheslav Gerasimov 7d0935a8c5 Build: Refactor :js:js.tests:runMocha task
Introduce separate mochaTest task without dependency on test task
2022-12-09 20:42:07 +01:00
Dmitriy Novozhilov 5d6cb2b691 [Test] Use IrPluginContext for searching declarations for DUMP_EXTERNAL_CLASS check 2022-12-09 12:02:07 +00:00
Zalim Bashorov 49c3ba33f1 [Wasm] Add a basic end-to-end sourcemap generation in wasm backend
More constructions/instructions will be supported separately.
2022-12-08 12:44:26 +00:00
pyos 0d46dfc1ba FIR: fix substitution of type arguments in SAM type aliases
^KT-54730 Fixed
2022-12-07 22:09:20 +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
Alexander Korepanov 0a35d84193 [JS IR] DTS generation refactoring
Keep a DTS fragment in JsIrProgramFragment
 for each file and build the module DTS from them.
2022-12-07 18:05:52 +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
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
Sergej Jaskiewicz 1539d7ef1a [klib] Bring package names in sync with the directory layout
Basically, some package names were Native-specific, whilst the packages
themselves were not Native-specific at all. This was already reflected
in the directory layout, but not in the package names.
This is fixed here.

NFC, just an automatic rename of packages with fixes of imports.
2022-12-01 21:46:43 +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
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
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
Alexander Korepanov 9fcd185141 [JS IR] Set kotlin.js.test.root.out.dir for IC tests
Property kotlin.js.test.root.out.dir is required for
 JS IR IC tests, otherwise they can't be run from IDEA.
2022-11-28 16:13:10 +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
Artem Kobzar ad78f27cce [K/JS] Fix problem with dynamic return type inside coroutine 2022-11-23 21:33:56 +00:00
Anton Bannykh e42385dfb0 JS tests: split fir, ir, and legacy tests
Also split write FIR output to separate folders
2022-11-23 11:01:13 +00:00
Anton Bannykh f99d480bf8 JS: move DCE test output to build/ dir 2022-11-23 11:01:13 +00:00
Anton Bannykh 56765461a0 WASM: move output to build/ dir 2022-11-23 11:01:12 +00:00
Artem Kobzar 725a224f74 [K/JS] Make available transitive reexport for ES modules 2022-11-18 16:54:10 +00:00
Sergej Jaskiewicz becbc06663 [JS] Re-enable some stepping tests 2022-11-18 10:37:58 +00:00
Sergej Jaskiewicz 932e1a3c1d [JS] Re-run stepping tests if they fail because of a Node crash
KT-54283
2022-11-18 10:37:58 +00:00
Anton Bannykh e6801abce8 JS IR: move IC tests output to build/ dir 2022-11-17 09:24:54 +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
Svyatoslav Kuzmich 78bd6dbdcd [Wasm] Allow implementing function interfaces 2022-11-14 11:23:18 +01:00
Ilya Chernikov b28dd95621 FIR JS: rename test classes for uniformity 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 5baf4a55c1 FIR JS: fix nodejs box tests infrastructure 2022-11-12 16:28:24 +01:00
Ilya Chernikov 4e4511bba2 FIR2IR: convert enums with non-primary default ctor correctly
see added test for example
2022-11-12 16:28:24 +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 89ba1b515e [Wasm, test] Use "dynamic import" to catch exception thrown during JS & Wasm modules initialization 2022-11-11 16:22:10 +01:00