Commit Graph

6801 Commits

Author SHA1 Message Date
Ilya Goncharov 7ae85ed68e [JS IR] Module descriptors depends on each other 2023-01-23 16:16:48 +00:00
Roman Efremov 878608b7b2 Don't add Enum.entries to scope if it can't be called
^KT-53929 Fixed
2023-01-23 12:53:06 +01:00
Roman Efremov 14b4cdc7c4 Write "hasEnumEntries" flag into metadata when feature enabled
^KT-53929 Fixed
2023-01-23 12:53:04 +01:00
Sergey Bogolepov c22285f824 [IR] Remove unused Ir.irModule property
It is required for the Native backend refactoring
where `Context` does not contain a reference for any
particular IrModuleFragment.
2023-01-20 13:33:06 +00:00
Ilmir Usmanov 945cdc8884 Minor. Ignore tests in JS_IR_ES6, regenerate tests 2023-01-19 17:04:31 +01:00
Ilmir Usmanov d18672bfb1 Wrap continuation with ContinuationImpl on callable references
in startCoroutineUninterceptedOrReturn. Otherwise, the coroutine will
not be interceptable later.

Add a test, which checks, that intercepted continuation is released.

 #KT-55869
2023-01-19 00:35:36 +00:00
Pavel Kunyavskiy 2843c0ad1e [K/N] Fix cleaning stack-local primitive array
^KT-55984
2023-01-18 11:52:43 +00:00
Artem Kobzar c4eca5f2df [K/JS] Exclude componentN methods from JsExport 2023-01-17 21:18:50 +00:00
Artem Kobzar 71486a321c [K/JS] Add support of compilation with ES-classes 2023-01-17 18:14:17 +00:00
Alexander Korepanov a4192c38f2 [JS IR IC] Remove JS files of the deleted modules from the out directory 2023-01-17 15:48:37 +00:00
Alexander Korepanov 75931fb9c8 [JS IR IC] Do not read non modified JS into memory
Optimizaion: instead of reading all non modified JS files
 from the cache into the memory at once, the patch allows
 copying non-modified JS files from disk one by one
 during the compilation output writing routine.
2023-01-17 15:48:36 +00:00
Alexander Korepanov c502cae437 [JS IR IC] Calculate symbol hashes on demand
Optimization: often we don't need all hashes for all available symbols.
 This patch allows the calculation of the symbol hash only on demand.

 This patch also allows cycles for the inline function dependency
 graph in the IC infrastructure. Note that the inline function cycles
 may crash the inliner, however it is not the IC infrastructure
 responsibility to check the cycles.
2023-01-17 15:48:36 +00:00
Dmitriy Novozhilov 83cbd322fd [Test] Prohibit declaring dependency on the same module with different kinds in module structure 2023-01-17 14:51:27 +00:00
Svyatoslav Kuzmich 951b8026f5 [JS, Wasm] Don't generate unused constructors for interfaces 2023-01-17 09:14:57 +00:00
Mikhail Glukhikh 89dd28226b BinaryVersion: introduce isCompatibleWithCurrentCompilerVersion 2023-01-16 18:12:55 +01:00
Abduqodiri Qurbonzoda dc03a03762 Introduce basic, url-safe and mime Base64 variants #KT-9823 2023-01-16 11:24:49 +00:00
Alexander Korepanov a5c8e30bb1 [JS IR] Use a copy of an original inline function for inlining
If inline function A calls another inline function B,
 we must use the original version of inline function A for inlining,
 which doesn’t have inlined function B. Because during the inlining
 process, we remap all occurrences of inline function A
 to a temporary copy of function A, and if the function B
 somehow uses function A (e.g. callable reference),
 the built IR will have a reference to the temporary function,
 not the original one. All these things lead to broken cross-module references.

 This patch saves the original versions of all inline functions
 before inlining and provides them during the inline process.

^KT-55930 Fixed
2023-01-16 11:01:03 +00:00
Pavel Kunyavskiy fc95b88eef [K/N] Tests for volatile
^KT-54944
2023-01-16 08:34:23 +00:00
Svyatoslav Kuzmich d14d4c8510 [Wasm] Support JsModule and JsQualifier 2023-01-13 21:58:34 +00:00
Svyatoslav Kuzmich 75d3ae4466 [Wasm] Don't try to lazy-initialize properties with 'definedExternally'
NFC for K/JS since externals live in a separate place
2023-01-13 21:58:33 +00:00
Svyatoslav Kuzmich fd67464d14 [Wasm] Test infra: support _commonFiles and additional .mjs
Use custom `evalToBoolean` as `eval` and `unsafeCast` are not
 available in Wasm stdlib
2023-01-13 21:58:33 +00:00
Svyatoslav Kuzmich 80e07d628b [Wasm] Use ModuleKind.ES
As the only JS-interop module kind Wasm supports
2023-01-13 21:58:32 +00:00
Artem Kobzar 6a6308bef2 [K/JS] add miss StartProjection for the substitution inside lowerings ^KT-55852 Fixed 2023-01-13 13:28:42 +00:00
Sergej Jaskiewicz 4a2a77d9b9 [K/N] Make classes generated from λs that use generic parameters generic
Previously, a function reference that used generic parameters from its
outer scope was lowered into a top-level non-generic subclass of
`FunctionN`, with `FunctionN` type arguments referencing type parameters
not present in the scope anymore. This sometimes resulted in generating
malformed mangled names.

From now on the generated subclass of `FunctionN` is generic. The needed
type arguments are passed upon instantiation, when the relevant generic
parameters are present in the scope.
2023-01-12 15:32:50 +00:00
Anton Bannykh 698be0fddd JS IR: custom JS AST serialization 2023-01-11 15:56:57 +00:00
Vyacheslav Gerasimov 417fef0d58 Build: Change node directory in :js:js.tests project to build/node
#KTI-1087
2023-01-11 11:58:40 +00:00
Svyatoslav Kuzmich 1564de5859 [Wasm] Support external vararg
Initial implementation copies Wasm array to JS array and spreads it
2023-01-11 10:35:36 +00:00
Alexander.Likhachev 202fe9e41e [Build] Fix configuration cache issue on running :js:js.tests:test
#KT-55839 Fixed
2023-01-10 19:08:09 +00:00
Artem Kobzar 642bbd38ba [K/JS] Move global interface id state into an object to prevent interface ids reinitialization ^Fixed KT-55758 2023-01-09 20:56:19 +00:00
Alexander Korepanov 5f10e605a9 [JS IR] Don't check an interface method default impl during JS translation
We do not need to check a default implementation of the interface during
 the translation to JS because it must be checked before.

 Moreover, this check breaks the produced JS code
 if IR is partial loaded, e.g. during the incremental rebuild.

^KT-55716 Fixed
2023-01-09 09:46:17 +00:00
Alexander Korepanov 155777e3fa [JS IR] Detect broken cross-module references
The patch adds an error if the module can not find the cross-module reference.

 The patch removes the DCE optimization which eliminates implement() intrinsic,
 because it leads to a broken cross-module reference and
 broken JS code with implement() call, albeit in an unreachable block.
2023-01-09 09:23:26 +00:00
Nikolay Lunyak e6efde76dc [FIR JS] Reuse declarations from JsStandardClassIds in both frontends 2023-01-09 08:57:13 +00:00
Nikolay Lunyak 85bcef537c [FIR JS] Support NON_EXTERNAL_DECLARATION_IN_INAPPROPRIATE_FILE 2023-01-09 08:57:12 +00:00
Nikolay Lunyak a20e29e8b7 [FIR JS] Implement FirJsExternalChecker
The JsAllowValueClassesInExternals feature is enabled explicitly,
because otherwise it's enabled
implicitly depending on the backend. See:
org/jetbrains/kotlin/test/builders/LanguageVersionSettingsBuilder.kt:90

A property may have a fake source return kind, while its accessor
has a real source kind. In this case we can't "just copy"
the property return type down to the accessor.
2023-01-09 08:57:11 +00:00
Nikolay Lunyak 56285bb2d6 [FIR JS] Report CALL_TO_DEFINED_EXTERNALLY_FROM_NON_EXTERNAL_DECLARATION 2023-01-09 08:57:11 +00:00
Nikolay Lunyak f422a3a4e8 [FIR JS] Report WRONG_JS_QUALIFIER for the argument of JsQualifier 2023-01-09 08:57:08 +00:00
Nikolay Lunyak 5ae9444745 [FIR JS] Add a test runner for FIR JS with old diagnostic tests 2023-01-09 08:57:07 +00:00
Abduqodiri Qurbonzoda 4af0f110c7 Fix 'Test: stdlib-js public kotlin api test' IDEA run configuration
Moving tests to another package made the IDEA run configuration obsolete.
To prevent this problem in the future a separate task (jsStdlibApiTest)
was introduced. The task is run in TC and will fail if the tests are missing.

Merge-request: KT-MR-8128
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-01-07 12:30:52 +00:00
Artem Kobzar 7d881842b4 [K/JS] Include protected member declarations into checked by JsExportDeclarationChecker declarations ^Fixed KT-55786 2023-01-05 16:30:23 +00:00
Igor Yakovlev f7940a2d46 [Wasm] Fix invalid cast generation for inline classes 2023-01-04 17:16:04 +00:00
Artem Kobzar 97be632c9a [K/JS] Add @ts-ignore for the case when there is a class with a private primary constructor (or excluded from export) which has an exported subclass ^Fixed KT-52563 2023-01-04 15:21:40 +00:00
Vladimir Dolzhenko 4542b3947b Clean up: rename Jet* to Kt* 2023-01-03 16:36:53 +01:00
Alexander Udalov 3c4b5529af Update year to 2023 in COPYRIGHT_HEADER.txt
This commit is the result of changing the year to 2023 in
COPYRIGHT_HEADER.txt and running all `generate*` tasks in
`generators/build.gradle.kts`.
2023-01-02 22:52:15 +01:00
Svyatoslav Kuzmich 9bc6b420a9 [Wasm][Stdlib] Add public APIs for linear memory access
Needed for interop with APIs that use linear memory.
2022-12-29 19:25:23 +00:00
Igor Yakovlev 71afbb36f5 [Wasm] Introduce Xwasm-generate-wat compiler flag (disabled by default) 2022-12-29 11:57:48 +00:00
Igor Yakovlev fc80104d55 [Wasm] Fix external functions import clashing 2022-12-29 11:57:47 +00:00
Igor Yakovlev 3be3ae4895 [Wasm] Fix invalid boxing for non-primitive typed vararg 2022-12-29 11:57:46 +00:00
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