Commit Graph

2874 Commits

Author SHA1 Message Date
Ilya Goncharov f22de86954 [JS IR] Possibility to use export for nested inside object
[JS IR] Fix test data after master rebase

[JS IR] Use stdlib's listOfNotNull

[JS IR] Possibility to use export for nested inside object

- Add tests for such cases

Merge-request: KT-MR-4883

^KT-49363 fixed
2021-11-03 09:56:22 +00:00
Sergej Jaskiewicz 42c213d950 [JS IR] Explicitly convert Long values to String in string concatenation
#KT-39891 Fixed
2021-11-02 10:42:28 +00:00
Ilya Goncharov 9fdb0a23cd [JS IR] Add literal and union types to TS generation, support them for enum
^KT-37916 fixed
^KT-44494 fixed
2021-11-01 13:28:24 +00:00
Ilya Goncharov 4fa2fa6c26 [JS IR] Export name and ordinal for enum classes
^KT-37916 fixed
^KT-44494 fixed
2021-11-01 13:28:24 +00:00
Ilya Goncharov a31a6c5117 [JS IR] Fix conflict with master
^KT-37916 fixed
^KT-44494 fixed
2021-11-01 13:28:23 +00:00
Ilya Goncharov 993b194a7b [JS IR] Actualize JS files according to TS tests
^KT-37916 fixed
^KT-44494 fixed
2021-11-01 13:28:22 +00:00
Ilya Goncharov 817e3dc306 [JS IR] Add TypeScript export tests for enum class
^KT-37916 fixed
^KT-44494 fixed
2021-11-01 13:28:21 +00:00
Ilya Goncharov cd1296309f [JS IR] Add constructor parameter to test and values, valueOf methods
^KT-37916 fixed
^KT-44494 fixed
2021-11-01 13:28:21 +00:00
Ilya Goncharov 9bd44e01f5 [JS IR] Export enum members like from usual classes
^KT-37916 fixed
^KT-44494 fixed
2021-11-01 13:28:20 +00:00
Ilya Goncharov 196dc6b071 [JS IR] Add test for enum exportness
^KT-44494 fixed
2021-11-01 13:28:19 +00:00
Artem Kobzar 979e9f94ef feat(Escaped Identifiers): add ability to use any symbol wrapped in back ticks. 2021-10-29 17:55:59 +00:00
Artem Kobzar 102072a229 fix(KT-40236): compute JsName from overridden symbols. 2021-10-29 14:09:31 +00:00
Artem Kobzar 7f7aa9a921 feat(Inner Classes): generate typescript type definitions and JS for Inner Classes. 2021-10-28 17:33:41 +00:00
Ivan Kylchik 8a1362de03 [JS TESTS] Rewrite web demo tests using new test infrastructure 2021-10-25 00:14:21 +03:00
Ivan Kylchik a2d2ace71a [JS TESTS] Rewrite js tests using new test infrastructure 2021-10-25 00:14:20 +03:00
Ivan Kylchik 4deab9693e [JS TESTS] Remove LANGUAGE_VERSION directive
Some of them are not necessary at all, others can be replaced with
`!LANGUAGE` directive with exclusion of corresponding features.
2021-10-25 00:14:20 +03:00
Ivan Kylchik 9c3e93024b [JS TESTS] Explicitly specify module name for typescript-export tests 2021-10-25 00:14:19 +03:00
Ivan Kylchik 3e1563d46e [JS TESTS] Rename JS_TESTS module to main 2021-10-25 00:14:19 +03:00
Ivan Kylchik 32e6d3908d [JS TESTS] Move MODULE_KIND directive to module level 2021-10-25 00:14:19 +03:00
Ivan Kylchik aaab22a675 [JS TESTS] Move dependency modules higher than main in test files 2021-10-25 00:14:19 +03:00
Ivan Kylchik 2bea77d4e2 [JS TESTS] Replace - symbol in module name with _ 2021-10-25 00:14:19 +03:00
Ilya Goncharov f6ba2a958a [JS IR] No generate exportness for overridden properties
[JS IR] Add check on existence of overridden property in tests

^KT-49326 fixed

[JS IR] Add details to comment with exporting properties

^KT-49326 fixed

[JS IR] No generate exportness for overridden properties,

if only no override val -> var

^KT-49326 fixed

Merge-request: KT-MR-4810
2021-10-21 10:52:48 +00:00
Artem Kobzar 876d358fe6 fix(KT-46961): add support of nested external enums. 2021-10-21 06:40:00 +00:00
Artem Kobzar 3dbf996ec6 fix(KT-49225): remove unnecessery boxing. 2021-10-21 06:38:42 +00:00
Anton Bannykh c2f7ed2fff [JS IR] added a directive to skip IC checks in IR 2021-10-15 20:14:53 +03:00
Sergej Jaskiewicz 8b2410733f [JS IR] Improve the test for exporting protected members 2021-10-15 12:52:11 +00:00
Svyatoslav Kuzmich 0f66f85cf9 [Wasm] Support main function 2021-10-15 13:58:55 +03:00
Igor Laevsky dcdc7e4633 [Wasm] Add box tests for kotlin.test 2021-10-14 17:24:03 +03:00
Sergej Jaskiewicz 55ae6d1f3e [JS IR] Optimize pattern-matching of enums into comparing their ordinals
For this code:
```
enum class Season {
    WINTER,
    SPRING,
    SUMMER,
    AUTUMN
}

fun bar1(x : Season) : String {
    return when (x) {
        Season.WINTER, Season.SPRING -> "winter_spring"
        Season.SUMMER -> "summer"
        else -> "autumn"
    }
}
```

previously we generated this:
```
function foo(x) {
    var tmp0_subject = x;
    return (tmp0_subject.equals(Season_WINTER_getInstance())
        ? true
        : tmp0_subject.equals(Season_SPRING_getInstance()))
            ? 'winter_spring'
            : tmp0_subject.equals(Season_SUMMER_getInstance())
                ? 'summer'
                : 'autumn';
}
```

And now we generated this:
```
function bar2(x) {
  var tmp0_subject = x;
  var tmp0 = tmp0_subject._get_ordinal__0_k$();
  var tmp;
  switch (tmp0) {
    case 0:
    case 1:
      tmp = 'winter_spring';
      break;
    case 2:
      tmp = 'summer';
      break;
    case 3:
      tmp = 'autumn';
      break;
    default:
      noWhenBranchMatchedException();
      break;
  }
  return tmp;
}
```
2021-10-14 11:44:01 +00:00
Artem Kobzar f645c89ebf fix(KT-43191): add static qualifier for Companion and non-inner objects. 2021-10-13 11:09:59 +00:00
Svyatoslav Kuzmich 90dd0c6150 [JS] Fix and mute failed tests on TC 2021-10-13 01:26:27 +03:00
Svyatoslav Kuzmich 279f184703 [JS] Remove failed checks based on unstable naming 2021-10-12 23:29:39 +03:00
Svyatoslav Kuzmich 3f8dce4b53 [JS IR] Support per-file mode and ES modules 2021-10-12 23:29:39 +03:00
Svyatoslav Kuzmich f479ac5c3a Remove implementation specific access to _ from test
Operator `new` is already tested with String class
2021-10-12 23:01:01 +03:00
Ilya Goncharov 669965d56c [JS IR] Generate main method call only for main module 2021-10-08 10:08:57 +00:00
Roman Artemev 7eb0fd4762 [JS IR] Unmute fixed tests 2021-10-07 16:00:50 +03:00
Sergej Jaskiewicz 65d40c2253 [JS IR] Make tests that use directives pass with IR BE 2021-10-06 09:23:50 +00:00
Roman Artemev 23cba59b90 [JS IR] Unmute fixed test 2021-10-01 23:02:22 +03:00
Ilya Goncharov 23c8433fce [JS IR] Eager initialization of adapter for kotlin.test tests 2021-10-01 13:32:13 +00:00
Sergej Jaskiewicz f0f60907e2 [JS IR] Fix generating property accessors
TL;DR, before we were emitting this JS code:
  Object.defineProperty(Base.prototype, 'bar', {
    configurable: true,
    get: Base.prototype._get_bar__0_k$,
    set: Base.prototype._set_bar__a4enbm_k$
  });

Now we emit this code instead:
  Object.defineProperty(Base.prototype, 'bar', {
    configurable: true,
    get: function () {
      return this._get_bar__0_k$();
    },
    set: function (value) {
      this._set_bar__a4enbm_k$(value);
    }
  });

This fixes the issue where if we had a @JsExport'ed base class with a
public property overridden in a non-exported derived class, we couldn't
access that property from JS if we were given an instance of
the derived class.

#KT-41912 Fixed
2021-09-28 20:04:38 +03:00
Roman Artemev 18950feeff [JS IR] Add tests for KT-48941 2021-09-28 18:15:48 +03:00
Sergej Jaskiewicz b3c681ee42 [JS IR] Tests for TS declarations of sealed classes
Also make sure we generate proper declarations for abstract and data
classes.

#KT-39364 Fixed
#KT-47376 Fixed
2021-09-28 13:54:48 +03:00
Roman Artemev 9123d426c3 [JS] Add test for KT-43374 2021-09-27 19:01:42 +03:00
Victor Petukhov a264cbfe7d Move CallUtil.kt under the resolve.util package 2021-09-27 16:12:01 +03:00
Victor Petukhov 1635bcad10 Move CallResolverUtil.kt under the resolve.util package 2021-09-27 16:12:00 +03:00
Roman Artemev 6efba76a06 [JS] Add test for KT-47811 2021-09-27 15:13:03 +03:00
Vyacheslav Gerasimov ab146bd6d4 Build: Fix deprecated Gradle configurations usages
for migration to Gradle 7+ #KTI-559
2021-09-26 18:28:44 +03:00
Roman Artemev 3b53c97c2c [JS IR] Fix test data 'kt -> ir -> klib -> ir -> js' aka prod mode
- fix order in dts tests
 - unmute fixed test in prod mode
 - mute filing expect-actual link test in prod mode
2021-09-13 13:44:46 +03:00
Sergej Jaskiewicz 2f07589b42 [JS IR] Avoid name clashes for @JsQualifier-annotated declarations
#KT-42039 Fixed
2021-09-10 15:48:43 +03:00
Sergej Jaskiewicz cb3d5f90e6 [JS IR] Export protected members too
#KT-47524 Fixed
#KT-47525 Fixed
2021-09-06 12:46:25 +00:00