Commit Graph

2735 Commits

Author SHA1 Message Date
Ilya Gorbunov 2fe222e8e7 Add SKIP_DCE_DRIVEN directive in JS-IR tests
Otherwise they fail with a compiler exception:
"An operation is not implemented: SAM conversion"
2020-06-17 19:45:15 +03:00
Anton Bannykh cbabb4f76a JS stdlib api test: various changes
- Setting -Doverwrite.output=true updates gold data
- Big packages don't get split into chunks
- Unique lines in the API are marked with /*∆*/ and diff test is removed
- Annotations on separate lines and other dump format tweaks
- Test data moved to libraries/stdlib/api/
- Minor visibility fix to Enum members
2020-06-15 11:49:15 +03:00
Anton Bannykh bd2a0563ad JS: fix explicit cross-module SAM constructor calls 2020-06-06 13:20:37 +03:00
Dmitry Petrov de25359a90 Fix stdlib compilation after updated @JvmName check
Previously, extension receiver type was not taken into account when
checking for @JvmName annotation applicability to possibly mangled
functions (such functions, however, were mangled).
This bug was fixed, but, unfortunately, not before such functions were
added to stdlib ('sumOf' family).
2020-06-04 12:16:28 +03:00
Dmitry Petrov 202bbdf8dd Forward compatibility hacks for Result.{success, failure}
Don't mangled functions annotated with @JvmName.
Annotate 'Result.success' and 'Result.failure' with @JvmName and
@Suppress("INAPPLICABLE_JVM_NAME").
NB this would require bootstrap.
2020-06-04 12:16:27 +03:00
Anton Bannykh a18bfad53a Add stdlib API test + remove some extra IR stdlib API's 2020-06-03 17:14:29 +03:00
Svyatoslav Kuzmich b0445496bb [JS] Autogenerate and mute missing test 2020-06-03 15:19:36 +03:00
Svyatoslav Kuzmich f8fdb0dc7e [JS] Add ; after functions in .d.ts
Fixes nit from KT-37752
2020-06-03 10:33:46 +03:00
Svyatoslav Kuzmich 2ca751a9fc [JS] Prevent default class constructors in d.ts files.
Generate private TypeScript constructor for classes without public
primary Kotlin constructor.
2020-06-03 10:33:45 +03:00
Svyatoslav Kuzmich 695d383ed1 [JS] Support secondary constructors in JsExport 2020-06-03 10:33:45 +03:00
Vitaly fe047f9b47 [JS BE] mutes tests for JS_IR_ES6, which muted for JS_IR 2020-05-27 00:32:56 +03:00
Vitaly a231b21c69 [JS BE] add tests for es6-classes 2020-05-27 00:32:55 +03:00
Svyatoslav Kuzmich c9adf22697 [JS] Remove binding context from NameSuggestion instance
Pass bindingContext to suggest method instead.
Revert creating multiple instances of NameSuggestion in checkers.
2020-05-22 17:05:30 +03:00
Svyatoslav Kuzmich 6e3d3831c2 [JS] JsExport diagnostics and legacy support
Account for JsExport in legacy backend namer. It means we
catch overloaded exported function conflicts for free!

Add error diagnostics:
* NESTED_JS_EXPORT (Fixes KT-36798)
* WRONG_EXPORTED_DECLARATION (Part of the fix for KT-37752)
* NON_EXPORTABLE_TYPE (Fixes KT-37771)
2020-05-22 10:50:22 +03:00
Abduqodiri Qurbonzoda bfffcf6b23 Update BoxJsTest expected reachable nodes because of new collection builders 2020-04-30 02:28:41 +03:00
Anton Bannykh 2992d49a1d JS IR: fix findAssociatedObjects for primitive type KClass'es 2020-04-28 19:08:44 +03:00
Anton Bannykh 442331acc9 IR JS: support findAssociatedObject feature (KT-37418 fixed) 2020-04-27 17:23:19 +03:00
Anton Bannykh 81798282b9 JS: support explicit SAM constructor invocation 2020-04-15 17:13:21 +03:00
Svyatoslav Kuzmich 3ec13d5bd6 [JS IR BE] Support companion objects in external interfaces
These objects are referenced but value is not actually used.
Replace access to these references with null literals.
2020-04-07 21:19:14 +03:00
Victor Turansky 79bec82430 KT-34770 JS. Configurable properties. Test 2020-04-07 16:15:02 +03:00
Victor Turansky 5652d2657d KT-34770 JS. Configurable properties. Old backend 2020-04-07 16:14:21 +03:00
Victor Turansky 4d219d1eed KT-31126 JS. Fix super constructor call. Test infra comment
Primary ordinary -> secondary external
2020-04-07 09:30:22 +03:00
Victor Turansky be39151fad KT-31126 JS. Fix super constructor call. Tests
Primary ordinary -> secondary external
2020-04-07 09:30:22 +03:00
Victor Turansky 6859e87be1 KT-31126 JS. Fix super constructor call. Old backend
Primary ordinary -> secondary external
2020-04-07 09:30:22 +03:00
Dmitry Petrov 24b8495e00 KT-30419 Box inline classes in return types of covariant overrides
Use boxed version of an inline class in return type position for
covariant and generic-specialized overrides.

Also fixes KT-35234 and KT-31585.
2020-04-01 22:59:14 +03:00
Alexander Udalov 8dd04789ad Remove obsolete InlineStrategy
Replace corresponding metadata property in js.ast with Boolean. This
allows to get rid of dependency of 'js.ast' on 'frontend'.
2020-03-28 21:30:03 +01:00
Zalim Bashorov 7cf8697e30 [JS BEs] use star projection when type parameter used recursively
#KT-37128 Fixed
2020-03-13 10:15:56 +03:00
Zalim Bashorov 8c7562d338 [CJS BE] don't crash when intersection types passed for a reified parameter
#KT-37163 Fixed
2020-03-13 10:15:53 +03:00
Svyatoslav Kuzmich f113c22450 [JS IR BE] Fix enum entry initialization
Keep helper fields uninitialized. This way thier initialization
would not depend on field initialization order.
2020-03-11 14:28:20 +03:00
Anton Bannykh 63a909dee6 JS: fix KT-37386
Anonymous object constructor parameters should not reuse JsName's
of the super class. Otherwise the temporary name renamer gets
confused.
2020-03-11 12:15:23 +03:00
Roman Artemev 7430bfe518 [KLIB] Update test data
- mute temporary broken test
 - add regression test
2020-03-10 11:12:08 +03:00
Roman Artemev 5dcac16cf7 [JS IR] Update test data 2020-03-03 18:54:36 +03:00
Roman Artemev 161bb72439 [JS IR] Update test data 2020-03-03 18:54:36 +03:00
Svyatoslav Kuzmich 3ecee5c7cd [JS IR BE] Implement kotlin.js.jsTypeOf as intrinsics 2020-02-27 16:54:55 +03:00
Svyatoslav Kuzmich dff7d7b7b9 [PSI2IR] Patch parents before referenceExpectsForUsedActuals
There were some ADAPTER_FOR_CALLABLE_REFERENCE functions with
uninitialized parents at this point.
2020-02-27 16:54:55 +03:00
Svyatoslav Kuzmich cd80eced32 [JS IR BE] Use fresh name for external JsModule declarations. 2020-02-27 16:54:55 +03:00
Anton Bannykh e7816b4ec2 JS: support callable references with vararg and default parameters conversion 2020-02-27 15:12:49 +03:00
Anton Bannykh 23e218396e JS: support SAM conversion
The SAM adapter is generate on declaration site. This is different
from the JVM approach.

`external fun interface` is banned for now.

Reusing interface declaration for the adapter is a hack which
reduces code size and makes importing/exporting the adapter
effortless.
2020-02-26 18:57:11 +03:00
Pavel Kirpichenkov 07ca355af8 [NI] Fix smartcasts for conventional contains in when
Call argument for conventional `contains` after expanding `in` may come from a `when` subject during its branch analysis.
In this case data flow info from a previous when branch was not considered,
because data flow info for subject had been used instead of data flow before argument.
Use of the latter one for the conventional `contains` solves the issue.

The old FE uses `isExternal` property of value arguments to skip smartcast reporting on `when` subject,
if they come from branches. To prevent undesired smartcasts on `when` subject after branch analysis in the new FE,
`isExternal` arguments are skipped in diagnostic reporter and during recorded type update.

Also, the new FE interprets `isExternal` completely differently from the old FE.
In the old FE this property is used exclusively by `when` with subject.
In the new FE it is also used for parially resolved calls, lambda return arguments and receivers.
This may be preventing the use of data flow info before argument in the first place, but this assumption requires additional investigation.

^KT-36818 Fixed
2020-02-20 19:07:54 +03:00
Anton Bannykh 5605eb5a31 Review fix: add TODO comments 2020-02-06 21:03:41 +03:00
Anton Bannykh 1e96c3d21e DCE-driven mode
:js:js.tests:jsIrTest works same as before
:js:js.tests:jsPirTest runs tests in DCE-driven mode
2020-02-06 21:03:41 +03:00
Victor Petukhov 4490efab3e [NI] Use original descriptor for functions imported from object during JS mangling
^KT-35904 Fixed
2020-01-30 19:55:41 +03:00
Abduqodiri Qurbonzoda b06645d1c0 Update number of reachable nodes because of MutableList.removeFirst/Last 2020-01-29 17:53:08 +03:00
Zalim Bashorov e6074e8759 [JS BE] Unmute test 2020-01-22 15:20:41 +03:00
Dmitriy Novozhilov 76b3964e96 Update testdata according to change compiler version to 1.4 2020-01-17 10:33:50 +03:00
Zalim Bashorov ee06678484 [JS BE] Fix is check with Function
#KT-33149 fixed
2019-12-26 22:49:53 +03:00
Roman Artemev cad3cb1bbe [KLIB] Fix references to type made from TypeParameter in KotlinMangler
- promote ABI version
2019-12-17 17:56:07 +03:00
Anton Bannykh 9a971172c9 JS: fix object expression constructor delegation to secondary constructors with default arguments (KT-30517 fixed) 2019-12-15 15:21:23 +03:00
Abduqodiri Qurbonzoda dabf6376db Update js reachable nodes count after expanding StringBuilder api 2019-12-06 05:37:09 +03:00
Roman Artemev 4759c16428 [JS IR] Fix IrGetClass for Throwable successors
- add test
2019-11-28 14:45:34 +03:00