Commit Graph

162 Commits

Author SHA1 Message Date
Svyatoslav Kuzmich a6afb7cb41 [JS IR][Wasm] Preload (Suspend)FunctionN needed in lowerings
This reverts commit 15d178d850d15675ee39cbd833d13f4c8aed83ff.
2021-10-12 08:42:01 +03:00
Svyatoslav Kuzmich 3bce0cc055 [Wasm] Support coroutines
- Reuse JS IR Suspend function lowering
  - Fix types
  - Disable reinterpretCast-based optimization for inline
    classes
- Add basic support to Wasm stdlib
- Explicitly transform suspend functions into regular functions
  with continuations
- Clean suspend function handling from JS IR codegen
2021-10-12 08:42:01 +03:00
Ilya Goncharov b5fb0d9f33 [JS IR] Deprecate safeProperty(Get|Set) methods from stdlib 2021-10-01 13:21:19 +00:00
Ilya Goncharov 42e8017cc7 [JS IR] Revert removing of safeProperty(Get|Set) 2021-09-24 07:07:12 +00:00
Ilya Goncharov 064744fae7 [JS IR] Remove redundant legacy property access property 2021-09-24 07:07:12 +00:00
Abduqodiri Qurbonzoda f1befc0108 Format Other_Uppercase/Other_Lowercase property as an identifier in docs 2021-09-15 17:31:52 +03:00
Mikhail Glukhikh ed035d99ab Migrate -Xopt-in to -opt-in in Gradle Kotlin scripts 2021-09-03 15:40:47 +03:00
Abduqodiri Qurbonzoda 0faa83bacb Deprecate JS Array/PrimitiveArray.sort(comparison) functions 2021-09-02 01:38:03 +00:00
Ilya Goncharov 766857881a [JS IR] Review remarks
- Use intrinsic on this
- Enqueue invoke for DCE
- Change transform
- Ignore instead of target backend

^KT-46204 fixed
2021-08-10 07:24:51 +00:00
Ilya Goncharov a28138eb72 [JS IR] Change js function on Kotlin code
^KT-46204 fixed
2021-08-10 07:24:49 +00:00
Ilya Goncharov 627af332b1 [JS IR] Use PublishedApi for intrinsic
^KT-46204 fixed
2021-08-10 07:24:48 +00:00
Ilya Goncharov e6af3ff6a8 [JS IR] Rename and doc new intrinsics, add new intrinsic to call suspend fun as supertype
^KT-46204 fixed
2021-08-10 07:24:48 +00:00
Ilya Goncharov a70fc99130 [JS IR] Add intrinsic to call suspend functions as super type
^KT-46204 fixed
2021-08-10 07:24:47 +00:00
Ilya Goncharov 755f847ab9 [JS IR] Use invoke for coroutines in runtime
^KT-46204 fixed
2021-08-10 07:24:46 +00:00
Ilya Goncharov 3c9dcdbbee [JS IR] Generate suspend function as invoke
[JS IR] Fix type check utils to work with array of arities

[JS IR] Store multiple arities for suspend functional interface implementers

^KT-46204 fixed
2021-08-10 07:24:46 +00:00
Alexander Udalov 91c39ed01c Build: remove obsolete compiler arguments
These compiler arguments enable features which are enabled by default in
the current Kotlin anyway.

The only exception is in :compiler:cli which uses an old language
version.
2021-07-27 13:35:38 +02:00
Mikhail Glukhikh 47c8bab48e Replace -Xuse-experimental with -Xopt-in in codebase 2021-07-12 21:26:17 +03:00
Ilya Goncharov 82f979b11f [JS IR] Add property name to boolean in externals diagnostic 2021-06-29 10:12:55 +00:00
Ilya Goncharov 21a3494bca [JS IR] Add test with boolean in external interface
[JS IR] Add possibility to safely access Boolean in external declaration

[JS IR] Add diagnostic for booleans in externals
2021-06-29 10:12:54 +00:00
Alexander Udalov f430d569d0 Fix warnings in js-ir/runtime/jsIntrinsics.kt
Suppress "UNUSED_PARAMETER" to fix compilation warnings. Also suppress
"unused" to make the file less yellow in the IDE.

Also enable `-Werror`, unless Gradle property
`kotlin.build.disable.werror` is set to true.
2021-06-28 12:19:35 +02:00
Anton Bannykh 48fe46303d JS IR: declare intrinsics for lowerings in stdlib
- simplifies lowered IR serialization
- removes some hacks in jsOperators.kt
- intrinsics can be directly invoked in stdlib
2021-06-18 15:26:52 +03:00
Abduqodiri Qurbonzoda d934c97bf5 Equivalize isLowerCase and isUpperCase behavior in all platforms #KT-46184 2021-05-31 13:42:46 +03:00
Abduqodiri Qurbonzoda 54994a289f Support all digit chars on JS and Native #KT-46002 2021-05-27 06:56:52 +03:00
Anton Bannykh 6633a9edc0 [JS IR] add a flag which enable safe property access
If an accessor is not available at runtime we fall back
to the property access.

This is useful in cases when JS objects are casted to Kotlin
classes implicitly. This pattern did work in the old BE, which
lead to a significant amount of code which doesn't work anymore.
2021-05-20 16:37:34 +03:00
Ilya Gorbunov ce7092a638 More efficient Char(Int) in common, JS, and JS-IR 2021-04-16 03:58:34 +03:00
Abduqodiri Qurbonzoda 98d31a1813 Expand KDoc of inc() and dec() operators #KT-43701 2021-04-10 03:23:04 +03:00
Abduqodiri Qurbonzoda f99c72cc98 Remove redundant @OptIn targeting new case conversion api 2021-04-08 03:21:59 +03:00
Ilya Gorbunov b64b96eee6 Deprecate Char-to-Number conversions in stdlib (JVM and JS)
- Int.toChar was left non-deprecated because the replacement is not intrinsic yet.
- Number.toChar was left non-deprecated because otherwise the deprecation propagates to the override, Int.toChar.

KT-23451
2021-04-07 18:30:20 +03:00
Ilya Gorbunov d70edeb38b Hide deprecated JS Math object from public API and rename to JsMath
KT-41318

- Rename Math to JsMath and remove unused functions
- Fix return types, remove duplicating JsMath from longjs.kt

Co-authored-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2021-04-07 00:39:47 +03:00
Abduqodiri Qurbonzoda 968099fbec Advance deprecation level of FP to lesser than Int types to ERROR #KT-30360 2021-04-07 00:23:20 +03:00
Ilya Gorbunov 8b85bae020 Stabilize Char-to-Int conversions KT-45874 2021-04-03 10:30:50 +03:00
Alexander Likhachev 6bd44df861 [Build] Fix configuration cache issues (part 6)
Make DexMethodCountStats task class, tasks :examples:kotlin-jsr223-daemon-local-eval-example:test,:idea:idea-fir:test, :idea:idea-fir-performance-tests:test, :idea:idea-frontend-fir:test, :idea:idea-frontend-fir:idea-fir-low-level-api:test, :kotlin-compiler-client-embeddable:test, :kotlin-compiler-embeddable:test, :kotlin-stdlib-js-ir:compileTestKotlinJs, :plugins:android-extensions-compiler:test, :plugins:parcelize:parcelize-compiler:test, :compiler:test compatible with configuration cache
Relates to #KT-44611
2021-03-11 14:12:36 +03:00
Alexander Likhachev 5f10c98a38 [Build] Fix configuration cache issues (part 3)
* Make IntelliJInstrumentCodeTask compatible with configuration cache
* Make CoreXmlShadingTransformer compatible with configuration cache
* Make :kotlin-reflect:relocateCoreSources compatible with configuration cache
* Copy some properties to not capture it's owning object into lambda to support configuration cache
Relates to #KT-44611
2021-03-11 14:12:34 +03:00
Ilya Gorbunov 7e2c365b79 Generate docs for floorDiv and mod and improve docs for div and rem
Refactor operator documentation generation for primitives and unsigned
types so that it is easier to specialize it.

Manually sync docs of numeric types in js-ir stdlib.

 KT-26234
2021-03-05 07:32:16 +03:00
Abduqodiri Qurbonzoda 2266cd4631 Commonize Char.titlecaseChar() and Char.titlecase() #KT-44369 2021-03-02 01:11:45 +03:00
Ilya Goncharov bd2601f289 [JS IR] Extract adding of function call to another function
[JS IR] Add option for dce mode

[JS IR] Add logging to non useful declarations if appropriate dce mode

[JS IR] Add mode with throwing exception

[JS IR] unreachableDeclaration method is in rootDeclarations

[JS IR] Add js extra help arg with dce mode and include debug.kt to compile unreachableMethod

[JS IR] unreachableDeclaration as internal to not reproduce stdlib api

[JS IR] Fix description of dce mode argument

- Use console.error instead of console.log
- Use JsError instead Kotlin exception for lightweight

[JS IR] Remove body for throwing exception

[JS IR] Remove default parameter in unreachableDeclaration

[JS IR] Process without removing fields and declaration containers

[JS IR] Rename dce mode on dce runtime diagnostic

[JS IR] Use console.trace instead of console.error

[JS IR] Extract JsError

- Fix naming in prependFunctionCall
- Fix description on runtime diagnostic argument
- Using message collector instead of throwing exception

[JS IR] Distinguish unreachableMethods for log and exception

[JS IR] Extract checking of Kotlin packages of IrField

^KT-45059 fixed
2021-02-20 12:05:06 +03:00
Svyatoslav Kuzmich 218c246111 [JS] Fix extra js function capturing 2021-02-04 15:41:21 +03:00
Ilya Gorbunov 87e130e77a Remove obsolete diagnostics suppression
The diagnostic NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS is now
obsolete because internal constructors of inline classes became allowed.
2021-02-03 18:23:53 +03:00
Abduqodiri Qurbonzoda 46b7a774b5 Commonize CharCategory and related functions #KT-39177 #KT-43216 #KT-39906 #KT-30652 2021-01-28 01:41:24 +03:00
Svyatoslav Kuzmich cb3b1f8ae2 [JS IR] Fix referencing Kotin variables in inline JS code
Fixed by outlining JS code that uses Kotlin variables making usages of
these locals explicit and preventing bugs due to one-sided variable renaming.

This prevents using Kotlin variables as lvalue in JS code.
2021-01-25 19:18:44 +03:00
Alexander Udalov acd29481bd Regenerate sources of builtins and stdlib 2021-01-03 22:31:06 +01:00
Abduqodiri Qurbonzoda 662787b12b Straighten Char-to-code and Char-to-digit conversions out #KT-23451 2020-12-31 12:07:41 +03:00
Zalim Bashorov 72593e3d30 [JS IR] Revert jsClass_js-ir.kt to not break compatibility with older compiler versions 2020-12-24 20:03:23 +03:00
Zalim Bashorov d7e3f826bb [JS IR] Generate jsClass function inside the compiler instead of relying on declaration inside stdlib
We want to make its type parameter reified to do it we have to make it inline and non-external.
But we don't want to inline it in call sites and want prevent using it anywhere except places generated by the compiler.
In user code, including stdlib, we should use `K::class.js` instead.
Separately we have to intrinsify `K::class.js` to reduce overhead.
2020-12-24 20:03:23 +03:00
Zalim Bashorov df6635085b [JS IR] Replace calls with invalid type arguments for type parameters with call to errorCode function from runtime. 2020-12-24 20:03:22 +03:00
Ilya Gorbunov 8f4e4a4d40 Specify common sources for stdlib test compilation tasks
Some multiplatform tests are compiled in single-platform projects:
- in kotlin-stdlib-jdk7
- in kotlin-stdlib-jdk8
- in kotlin-stdlib-js-ir. The latter is technically MPP but with a
single platform, so its common sources are not considered as common.

Pass information about common sources to test compilation tasks in order
to use OptionalExpectation annotations there.

Co-authored-by: Svyatoslav Scherbina <svyatoslav.scherbina@jetbrains.com>
2020-12-14 19:03:04 +03:00
Roman Artemev c16b11a124 [JS IR BE] Fix throwable stuff to make exceptions similar to JVM 2020-10-12 15:22:43 +03:00
Roman Artemev ff093d363a [JS IR BE] Fix Throwable ancestor transformation
Make sure that `message` and `cause` are properly configured

 - synchronize IR BE and Legacy behaviour
 - fix corresponding IR lowering
 - fix JS IR core runtime
 - add test
 - fix KT-39964
2020-10-12 15:22:43 +03:00
Abduqodiri Qurbonzoda 36e6247125 Add more details about bit shift operations #KT-41112 2020-09-16 04:05:12 +03:00
Roman Artemev 8a810e2a5e [JS IR] Add runtime API to throw ISE in case of compiled code with errors 2020-09-01 14:53:07 +03:00