Commit Graph

1504 Commits

Author SHA1 Message Date
Nikita Bobko ac40010501 [FE] Prohibit open val deferred initialization
^KT-57553 Fixed
Review: https://jetbrains.team/p/kt/reviews/9967

Other related tests:
- testUninitializedOrReassignedVariables
- testUseOfPropertiesWithoutPrimary
- @TestMetadata("compiler/testData/diagnostics/tests/secondaryConstructors")
- testAugmentedAssignmentInInitializer
- testInitOpenSetter
- testInitOverrideInConstructorComplex
- testPropertyInitializationOrder
2023-05-23 14:12:28 +03:00
Alexander Korepanov 2aea5822b2 [JS IR] Unmute all fir invalidation tests 2023-05-01 12:56:12 +00:00
Alexander Korepanov 9da9c95105 [JS IR] Add IC test for interface with default implementation 2023-05-01 12:49:07 +00:00
Ilya Gorbunov f470406150 Update EXPECTED_REACHABLE_NODES in JS testdata 2023-04-26 15:50:58 +00:00
Abduqodiri Qurbonzoda 63a5a74613 Introduce HexFormat for formatting and parsing hexadecimals #KT-57762
Merge-request: KT-MR-9460
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-04-26 09:54:25 +00:00
Artem Kobzar 27b103e2ca [K/JS] Eliminate duplication of init block inside exported ES-classes ^KT-58246 Fixed 2023-04-25 16:21:08 +00:00
Alexander Korepanov 81b591ed21 [JS IR IC] Interface default implementations affect IC hash
Adding or removing a method or property with
a default implementation to an interface should
invalidate all children: we must regenerate JS code for them

^KT-56237 Fixed
2023-04-25 15:34:22 +00:00
Nikolay Lunyak 360d236b7e [FIR JS] KT-57601: Get rid of the builtin provider
In this example we get 2 variants of `kotlin/toString()`:
one coming from the KLib provider, and the
other coming from the builtins provider.
These are identical deserialized functions.

^KT-57601 Fixed
2023-04-25 11:29:34 +00:00
Artem Kobzar 9bcfd093c5 [K/JS] Remove super keyword insertion if the body of method was moved into another place (private methods, lambdas, coroutines) ^KT-57990 Fixed 2023-04-24 13:54:36 +00:00
Ilya Chernikov 8cc9f911d5 FIR: temp: make klib symbol provider know parent packages
Current qualified access resolving algo rely (likely incorrectly,
see #KT-58037) on a providers' "knowledge" about parent packages.
This commit adds this "knowledge" to k-lib based provider.
#KT-57353 fixed
2023-04-19 11:42:03 +00:00
Alexander Korepanov 79d378f2bd [JS IR] Perform optimizations on the generated JS code
The patch adopts and reuses the optimizations from the legacy backend.

The optimizations remove useless temporary variables,
statements and simplify generated JS code.

The optimizations can be disabled by `-Xoptimize-generated-js=false`.

Related to KT-51139
2023-04-18 12:49:33 +00:00
Alexander Korepanov 980d83eccd [JS IR IC] Drop incremental cache after updating a klib set
Enabled Partial Linkage may replace entire IR expressions with a stub
during klib linking and loading. This may break the incremental cache
dependency graph. Dropping incremental cache files after updating klibs
(e.g. update klib version) covers almost all cases which
could not be tracked due to a broken dependency graph.

This patch could be reverted after fixing KT-57347
2023-04-18 09:06:07 +00:00
Artem Kobzar 20dea37be0 [K/JS TEST] Run TestGenerated check on generated TS tests 2023-04-14 14:45:11 +00:00
Artem Kobzar 73f8c984a1 [K/JS TEST] Fix the problem with running JS tests on Windows if the test has a long name 2023-04-14 10:46:52 +00:00
Artem Kobzar 5dc6da2b33 [K/JS] Add serialization/deserialization for JsImport/JsExport nodes 2023-04-13 12:58:46 +00:00
Artem Kobzar c695da1bed [K/JS] Allow declare inline functions inside external declarations with a million suppresses ^KT-48154 Fixed 2023-04-13 08:53:57 +00:00
Artem Kobzar 09bccd272d [K/JS] Prevent Char boxing on value or reference equals call 2023-04-13 08:39:03 +00:00
Artem Kobzar fa0f9a9201 [K/JS] Change strategy for implicitly exported declarations if there is a cycled reference
^KT-57356 Fixed
2023-04-11 13:48:47 +00:00
Kirill Rakhman 210e8750f4 [FIR] Deserialize nested typealias
#KT-57689 Fixed
2023-04-06 08:03:12 +00:00
Kirill Rakhman f9540d8f69 [JS] Remove non-functional IGNORE_FIR directive in js box tests 2023-04-06 08:03:12 +00:00
deotime 7aaba3b78a [KT-57607] Fix performance of ArrayList.addAll methods in JS stdlib (#5116)
* Fix performance of ArrayList.addAll methods in JS stdlib: extend the backing array and copy elements manually
* Update expected reachable nodes after DCE in test data

---------

Co-authored-by: Ilya Gorbunov <ilya.gorbunov@jetbrains.com>
2023-04-05 20:18:11 +02:00
Alexander Korepanov 4813b659ab [JS IR] Control an inheritance of non-external entity from external
Add a special annotation @JsExternalInheritorsOnly for marking
 external interfaces and classes. The marked interface or class
 can’t be a parent for non external interfaces, classes or objects.

^KT-57423 Fixed
2023-04-05 09:00:45 +00:00
Dmitriy Novozhilov 92a59279d5 [FIR] Properly implement serializer extension for klib compilation
^KT-57654 Fixed
2023-04-05 07:31:33 +00:00
Ivan Kylchik 7cf9dda8dc [JS] Support evaluation of const intrinsics for K2
#KT-56023 Fixed
#KT-51582 Fixed
2023-03-24 15:55:04 +00:00
Dmitriy Dolovov 66c278ff8d [JS][IC][test] Remove testBreakKlibBinaryCompatibilityWithVariance test
#KT-57078 Fixed
2023-03-23 10:24:28 +00:00
Dmitriy Dolovov 153aed29ba [JS][IC][test] Fix step numbers in tests 2023-03-23 10:24:28 +00:00
Ilya Chernikov aa3c189d83 FIR: fix return statement generation for Unit-returning lambdas...
for case then the expected return type is not Unit.
#KT-56747 fixed
2023-03-22 13:23:24 +00:00
Anton Bannykh b0de442d76 JS IR: fix throwable descendants
^ KT-43490 fixed
2023-03-21 12:32:41 +00:00
Kirill Rakhman 45d2424ad8 [FIR] Let prefix inc/dec call getter twice for compatibility with K1
#KT-57179 Fixed
2023-03-21 08:48:38 +00:00
Artem Kobzar 948c511284 [K/JS] Rework ES modules part with squashed JsImport and right renaming strategy inside import/export statements 2023-03-16 10:28:39 +00:00
Alexander Korepanov e3402fcc87 [K2 JS] Do not load transitive dependencies for building K2/JS klibs
^KT-57262 Fixed
2023-03-15 10:49:54 +00:00
Ivan Kylchik 1e2ae137bf Slightly change JS test data results in three files
This change is caused by previous commit and was extracted
as a separate change not to mix JVM and JS changes
2023-03-14 20:47:40 +00:00
Artem Kobzar ab7b429298 [K/JS] Add ability to use is checks on external objects 2023-03-10 11:33:30 +00:00
Artem Kobzar 484e5afb59 [K/JS] Remove unused Unit_getInstance import into generated code 2023-03-09 16:51:07 +00:00
Alexander Korepanov f82d3e63a2 [JS IR] Use a backing field initializer for js() code folding
During a translation of the code from js() call to statement list,
 the compiler folds the code string. For that it uses property bodies.
 However the bodies can not be loaded in an incremental rebuild.
 The patch uses the backing field initializers of constant properties.
 The initializers are always loaded.

^KT-57002 Fixed
2023-03-08 16:56:05 +00:00
Zalim Bashorov bec827b654 [Wasm] Update SpiderMonkey to 112.0a1 (2023-03-04-09-52-24) 2023-03-06 23:19:02 +01:00
Artem Kobzar 4eb5af68f4 [K/JS] Add @deprecated commentary if @Deprecated annotation exists on a declaration.
^KT-56405 Fixed
2023-03-03 10:18:11 +00:00
Artem Kobzar deb6ca66ea [K/JS] Add undefined type to parameter with default argument that are placed before non-optional parameters
^KT-53180 Fixed
2023-02-28 11:53:28 +00:00
Alexander Korepanov 3c9d653595 [JS IR] Ignore unbound symbols in IC infrastructure
The IR linker is responsible for detecting unbound symbols,
 if it skips them for some reason, IC infrastructure must not fail
 with unbound symbols exceptions. Anyway, the IR validator
 verifies later if there are unbound symbols in
 reachable IR and generates the corresponding error.

^KT-56602 Fixed
2023-02-21 14:46:44 +00:00
Alexander Korepanov 43cef114c6 [Compiler CLI] Sort flags and features before appending them to string
JS IR BE incremental compilation infrastructure uses
 LanguageVersionSettings::toString method to detect if any
 compiler features or flags were enabled or disabled.
 It is important that the features and flags order are stable
 in the result string.

^KT-56580 Fixed
2023-02-15 13:24:11 +00:00
Alexander Korepanov 121c920099 [JS IR IC] Load only top level signatures for function type interfaces
The dependency signature may refer to function type interface properties
 (e.g. name) or methods. It is impossible to detect (without hacks)
 which binary symbol for loading is required. However, when loading
 a property or a method the entire function type interface is loaded.
 And vice versa, a loading of function type interface loads
 properties and methods as well. Therefore, load the top level signature only,
 it must be the signature of function type interface.

^KT-56582 Fixed
2023-02-14 13:25:19 +00:00
Alexander Korepanov f367541393 [JS IR] Rename functionalInterface -> functonTypeInterface 2023-02-14 13:25:19 +00:00
Alexander Korepanov 9324cf3360 [JS IR] Support function type interfaces in incremental cache infrastructure
The patch removes logic of generating extra IrFiles (fake file) into
 IrModuleFragment for the function type interfaces during klib deserialization,
 because IC infrastructure can not process files which do not exist in klib.

 Instead of adding extra IrFiles during deserialization, the empty files
 with required packages are added into Kotlin/JS stdlib physically.
 These files are used as containers for function type interface declarations.

 Since Kotlin/WASM uses the same klib loading infrastructure as Kotlin/JS,
 the the empty files are added into Kotlin/WASM stdlib as well.

 The patch also adds a check that IrModuleFagment has files only from klib.

^KT-55720 Fixed
2023-02-03 12:23:48 +00:00
Svyatoslav Kuzmich 2e26b0956e [Wasm] Improve stability of wasm import names across compiler runs
Remove code generation for external fake overrides
Fake overrides are resolved to real declaration on call sites
This also removes generation of unused
"equals", "hashCode" and "toString" methods.
Avoid using hashes of IrType in generated code
because they are unstable

Merge-request: KT-MR-8658
Merged-by: Svyatoslav Kuzmich <svyatoslav.kuzmich@jetbrains.com>
2023-02-03 06:55:59 +00:00
Dmitriy Novozhilov 88efa6bfb6 Update tests after switching to LV 1.9 2023-01-30 09:29:57 +00:00
Zalim Bashorov b02279de14 [Wasm] Run wasm test using all available VMs: V8 & SpiderMonkey for now
Also, add a new directive, `WASM_FAILS_IN`, to specify VMs where a test is expected to fail for now.

#KT-56166 Fixed
2023-01-27 17:57:50 +01:00
Alexander Korepanov edbd05ba47 [JS IR] Hack IC invalidation test so it works with ES6 classes
Hack the IC invaliadtion test so the cross module references
 are invalidated in the same way as with ES6 classes and without.
2023-01-24 09:35:16 +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 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