Commit Graph

1534 Commits

Author SHA1 Message Date
Alexander Korepanov 752ce887b2 [JS IR] Add IC test for JsModule annptation
^KT-43455
2022-09-15 11:02:46 +00:00
Artem Kobzar da367a467d [K/JS] chore: stop unnecessary defineProperties generating. 2022-09-09 11:14:26 +00:00
Artem Kobzar a6d1f30e89 chore: generate extra files. 2022-09-07 12:46:45 +00:00
Artem Kobzar 24d73e5cb8 fix: test case for js name. 2022-09-07 09:04:07 +00:00
Sergej Jaskiewicz f07163125b [JS Legacy] For Unit Elvis don't forget to generate code for the RHS
^KT-53780 Fixed
2022-09-02 11:44:17 +00:00
Artem Kobzar 0bb0be8703 feat(KT-48814): represent all of the external declarations nullable properties as an optional fields inside d.ts. 2022-09-02 10:50:20 +00:00
Artem Kobzar 98474f0d13 chore: change line breaker for generated js files. 2022-08-29 18:06:27 +00:00
Artem Kobzar dbda8dcad1 [K/JS] test: add @file:JsExport tests for each @JsExport test + auto-generate TypeScript export tests. 2022-08-26 09:51:59 +00:00
Artem Kobzar e0a2400823 [K/JS] build: speedup tests rerunning with incremental typescript compilation for IrJsTyperScriptTests. 2022-08-25 18:02:56 +00:00
Sergej Jaskiewicz d57ddc5f83 [JS IR] Generate debug info for JS injections
Also, fix the JS parser to collect the "correct" debug info
(see the note in `translateJsCodeIntoStatementList`)

#KT-53361 Fixed
2022-08-22 23:15:52 +00:00
Sergej Jaskiewicz a152bc2313 [JS IR] Don't parse/print JS code in js() call twice
#KT-51327 Fixed
2022-08-22 23:15:52 +00:00
Artem Kobzar 8e17c39cc9 [K/JS] fix(KT-53569): skip double traversing for nested annotation classes. 2022-08-18 16:39:48 +00:00
Artem Kobzar ab6964d32e [K/JS] test(Inner Classes): check exported and not-exported inner classes inside kotlin. 2022-08-17 14:58:31 +00:00
Artem Kobzar 87038e7d8a [K/JS] feat: add logic under the flag for strict implicit export generating inside d.ts files. 2022-08-09 16:48:59 +00:00
Alexander Korepanov bb8da65188 [Common IR] Do inlining of callable references of inline functions
^KT-52805 Fixed
2022-08-08 17:40:45 +00:00
Artem Kobzar b9a80284c8 [K/JS] fix(TS): save type hierarchy for exported classes. 2022-08-03 14:16:30 +00:00
Artem Kobzar 0cef573a7b [K/JS] test(@JsExport): add few more tests on export after ExportModel discussion meeting. 2022-08-01 12:17:35 +00:00
Artem Kobzar b9189be728 [K/JS] fix(KT-46643): prevent removal of setter for overridden external field. 2022-07-29 12:41:17 +00:00
Alexander Korepanov caa1570e25 [JS IR] Fix clashes between bridge and delegated function call
The patch fixes the js function signature rules to avoid clashes
 between bridge and delegated call. Use overridden symbols dfs of
 JsName annotation in order to get the correct bridge name.

^KT-52968 Fixed
2022-07-28 14:41:47 +00:00
Alexander Korepanov 6525f7a7ac [JS IR] Fix a IC dependency building for class methods.
The patch fixes lost IC dependencies for inherited class or interface methods.
 Especially between a fake override function and its implementation.
 Since IrSymbolDeserializer doesn't provide all class methods,
 they are collected from the class definitions.

^KT-53063 Fixed
2022-07-28 12:39:39 +00:00
Alexander Korepanov 0982872959 [JS IR] Fix clash between generic extension overloads
Type parameter constraints are used for calculating JS signature hash.

^KT-51151 Fixed
2022-07-22 16:14:51 +00:00
Victor Petukhov 42e71f8c53 Remove explicit enabling the new type inference from test data 2022-07-22 16:03:52 +00:00
Svyatoslav Kuzmich 11c8c01a50 [Wasm] Update v8 shell to v10.5.207 2022-07-19 18:46:52 +02:00
Artem Kobzar 1557f919f5 chore: split huge declarations.d.ts test on few smaller tests. 2022-07-18 12:59:21 +00:00
Artem Kobzar 117df325c9 [JS/IR] fix: add ability to render type constraints into TypeScript definitions. 2022-07-13 15:20:27 +00:00
Alexander Korepanov 5b4e9e2966 [JS IR] Fix IC invalidation process when symbols are modified
The patch fixes the cases of IC invalidation when symbols are modified:
 adding and removing inline, data, in, out, suspend qualifiers.

 For that purpose an extra hash is used.
 It is written in a direct dependency graph into an IC cache metadata file.
 For inline functions a transitive hash is used.
 For non-inline functions, classes, and others a symbol hash is used.
 The invalidation routine marks the file as dirty
 (with 'updated imports' state) if hash is modified.

^KT-51083 Fixed
^KT-51088 Fixed
^KT-51090 Fixed
^KT-51099 Fixed
2022-07-05 12:45:43 +00:00
Alexander Korepanov 644447db84 [JS IR] Fix IC invalidation for fake override inline functions
The patch enables the direct dependency between
 fake override inline function and its implementation from the base class.

 Because klibs do not keep a signature of fake override implementation,
 incremental cache can not use the signature index,
 therefore the signature is serialized to a cache file as is.

^KT-51896 Fixed
2022-07-05 12:45:43 +00:00
Artem Kobzar 133c6713ca [K/JS] fix(Interface Export): prevent structural identity between two interfaces. 2022-06-28 15:44:38 +00:00
Artem Kobzar ba738cbbff feat: add ability to create nested entities inside object. 2022-06-22 11:59:13 +00:00
Sergej Jaskiewicz da7ff5b868 [JS IR] Fix replacing super.toString() call with a runtime function call
#KT-52553 Fixed
2022-06-16 10:03:14 +00:00
Alexander Korepanov 9e780afdca [JS IR] Rework incremental cache invalidation
Replace loading the whole world IR with loading only exported (reachable) IR.

 For that purpose the direct and inverse dependency graph is used.
 It is stored in a cache directory and the cache updater keeps it up to date.
 If after loading it is found that other files must be also implicitly rebuilt
 (see rebuilt reasons below), IR for that files also will be loaded.
 This algorithm repeats until the number of implicitly rebuilt files is not 0.

 More rebuilt reasons (dirty state) have been added:
  - added file: this is a new file;
  - modified ir: ir of the file has been updated;
  - updated exports: exports from the file have been added or removed
    (e.g. a function has been used from another file);
  - updated inline imports: imported inline function has been modified
    (transitively);
  - removed inverse depends: a dependent file has been removed;
  - removed direct depends: a dependency file has been removed;
  - removed file: this file has been removed.

 Incremental cache tests has been refactored:
  - The supporting of all rebuilt reasons (dirty states) has been added;
  - New file name format "*.$suffix.kt" for the test steps has been allowed,
    so the syntax highlight works now;
  - Explicit stdlib dependency usage has been removed.
2022-06-13 20:04:05 +00:00
Artem Kobzar e790607af5 feat(KT-51123): save comments from js-function call inside arguments list. 2022-06-13 12:58:18 +00:00
Nikolay Lunyak 994e2970c7 [FIR JS] Suppress EQUALITY_NOT_APPLICABLE 2022-06-02 13:47:30 +00:00
Nikolay Lunyak 0e549e3329 [FIR JS] Suppress INVISIBLE_REFERENCE 2022-06-02 13:47:27 +00:00
Nikolay Lunyak 5e97a36680 [FIR JS] Ignore tests with unsupported features 2022-06-02 13:47:26 +00:00
Nikolay Lunyak bdc3b5fe6f [FIR JS] Mute 170 failing multi-module tests 2022-06-02 13:47:24 +00:00
Sergej Jaskiewicz 58e2652ba6 [JS IR] Test in-line anonymous functions with extension functions 2022-06-01 09:02:32 +00:00
Sergej Jaskiewicz e03747ea7d [JS IR] Introduce the GENERATE_INLINE_ANONYMOUS_FUNCTIONS feature flag 2022-06-01 09:02:31 +00:00
Sergej Jaskiewicz c10af22b27 [JS IR] Lower lambdas into in-line anonymous functions when possible
Previously we always generated factories for contextful lambdas:

```kt
fun foo(a: Int) = { a }
```

```js
function foo(a_38) {
  return foo$lambda(a_38);
}

// factory!
function foo$lambda($a) {
  return function () {
    return $a;
  };
}
```

After this patch, the generated code for `foo` is more concise:

```js
function foo(a) {
  return function() { return a; };
}
```
2022-06-01 09:02:30 +00:00
Dmitriy Novozhilov c777ecd470 [JS] Unmute tests due to fixed KT-52339 2022-05-23 12:04:37 +00:00
Artem Kobzar 8bc5508f5c fix(KT-52339): add newlines to SourceMap to calculate multiline comments in a right way. 2022-05-20 13:35:54 +00:00
Svyatoslav Kuzmich d1c81eb6ba [Wasm] Support Wasm GC milestone 5 2022-05-20 12:22:43 +03:00
Artem Kobzar 4e06ff26d4 fix(KT-39423): add support of optional parameters to constructor + fix bug with optional parameters inside functions. 2022-05-13 10:46:32 +00:00
Ilya Goncharov 0c24d0ec9f [JS IR]Add case with file-exported class inherited from non-exported int
KT-52252

Merge-request: KT-MR-6270
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>
2022-05-13 10:41:16 +00:00
Dmitriy Novozhilov be76cd39d2 [JS] Ignore some tests due to KT-52339 2022-05-10 16:16:55 +00:00
Alexander Korepanov 9e591f3299 [JS IR] Add a test for external property accessor with a side effect. 2022-05-04 13:14:07 +00:00
Alexander Korepanov 57f16e801f [JS IR] Materialize Unit more aggressively for IrCalls
Unit materialization for IrCall is required for operations with dynamic type.

However it produces useless Unit_getInstance() calls,
especially in return expressions. The pach also adds some heuristics
for reducing the amount of Unit_getInstance() calls from return expressions:
do not add Unit_getInstance() if return value has Unit type.

Relaited to KT-51139
^KT-23252 Fixed
2022-05-04 13:14:06 +00:00
Artem Kobzar e1dd8d3868 test: generic classes exportability. 2022-05-04 11:25:34 +00:00
Artem Kobzar 729e24d053 fix: make sealed classes abstract inside d.ts files. 2022-05-04 11:24:47 +00:00
Ilya Goncharov 1fc7fbed79 rra/ilgonmic/export-call-site
[JS IR] Add test with exported overridden property from interface

[JS IR] Accessors should not be exported when overridden from non-exported interface

Merge-request: KT-MR-6166
Merged-by: Ilya Goncharov <Ilya.Goncharov@jetbrains.com>

^KT-52144 fixed
2022-04-29 12:13:09 +00:00