Commit Graph

3794 Commits

Author SHA1 Message Date
Filipp Zhinkin cadf4f63b0 KT-54739 Return single empty inst from collection builders(all src-sets)
Fixed remaining builders, added additional checks to a test.

^KT-54739 fixed
2023-04-26 12:05:15 +00:00
Ivan Kochurkin 0c1d957711 KT-54739 Return single empty instance from collection builders on JVM
- return single instance of emptySet for build method from SetBuilder
- return single instance of emptyMap for build method from MapBuilder
- return single instance of emptyList for build method from ListBuilder

^KT-54739 fixed
2023-04-26 12:05:15 +00:00
Ilya Gorbunov 2100f08655 Make subarrayContentToString internal 2023-04-26 10:44:52 +00:00
Ilya Gorbunov 937a14146a Hide experimental Duration functions that are not intended to be stabilized 2023-04-26 10:44:52 +00:00
Ilya Gorbunov f260b55810 Raise deprecation of js synchronized {} to error 2023-04-26 10:44:52 +00:00
Abduqodiri Qurbonzoda 2248f4ea33 Remove supportsNamedCapturingGroup flag in tests
Now it is true on all platforms
2023-04-26 10:44:21 +00:00
Abduqodiri Qurbonzoda 175566fe56 KT-51908 Common MatchGroupCollection.get(name) extension function 2023-04-26 10:44:21 +00:00
Ilya Gorbunov 448e9fc5e7 Drop functions hidden since 1.4 (inline-only or experimental in JVM)
Since it's no longer possible to use API version less than 1.4,
these functions can be no longer called at all.
2023-04-26 10:31:03 +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
Sergey Bogolepov fce878d63a [K/N] KT-56464: implementation of HiddenFromObjC for classes in backend 2023-04-26 09:36:10 +00:00
mvicsokolova 75b4469757 [K/N] Stabilization of Atomics API
`AtomicInt`, `AtomicLong`, `AtomicReference` and `AtomicNativePtr` classes were moved to `kotlin.concurrent` package. The corresponding classes from `kotlin.native.concurrent` were deprecated with warning since Kotlin 1.9.

In order to prepare for further commonization of Atomics API the following changes were made:
* `kotlin.concurrent.AtomicInt`: 
    * `increment(): Unit` and `decrement(): Unit` methods were deprecated with error
    * New methods were added: `incrementAndGet(): Int` , `decrementAndGet(): Int`, `getAndIncrement(): Int`, `getAndDecrement(): Int`, `getAndSet(newValue: Int): Int` 
* `kotlin.concurrent.AtomicLong`:
    * `increment(): Unit` and `decrement(): Unit` methods were deprecated with error
    * New methods were added: `incrementAndGet(): Long`, `decrementAndGet(): Long`, `getAndIncrement(): Long`, `getAndDecrement(): Long`, `getAndSet(newValue: Long): Long`
    * Deprecated `AtomicLong()` constructor with default parameter value
* For all atomic classes `compareAndSwap` method was renamed to `compareAndExchange`

See KT-58074 for more details.

Merge-request: KT-MR-9272
Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
2023-04-25 16:55:42 +00:00
Alexander Udalov bab88c05c3 JvmDefault: deprecate JvmDefault annotation class with ERROR
#KT-54746 Fixed
2023-04-25 14:33:00 +00:00
Alexander Udalov e0b5ae7781 JvmDefault: remove diagnostics related to @JvmDefault
#KT-54746
2023-04-25 14:33:00 +00:00
Ilya Gorbunov ace2279631 Refactor helper function to run/not run block of common code on specific platform
Use it in StringBuilder tests
2023-04-25 13:55:04 +00:00
Ilya Gorbunov 454e963aa7 StringBuilder capacity test: fixup deprecation suppression 2023-04-25 13:55:04 +00:00
Ilya Gorbunov 6dc2960b77 Relax back an assertion in testLongAdjustmentElapsedPrecision
Reverts the assertion strictening happened in commit 1014434475
2023-04-25 13:54:39 +00:00
Zalim Bashorov 77491ded1b Use Array constructor with size to create Array of nulls
Change the constructor visibility from public to private as it should be.
2023-04-22 17:41:23 +00:00
Svyatoslav Kuzmich 933f47aaf9 [Wasm] Rename JsHandle to JsReference
Decision to do this was made at Kotlin/Wasm interop design meeting
2023-04-21 15:03:20 +00:00
Svyatoslav Kuzmich 7ba8f7cce2 Revert "[Wasm] Deprecate @JsFun with warning"
Reason: Design of js(code) replacement is still in flux.
        It would be better to delay deprecation until we converge
        to proper solution.

This reverts commit 3566d918d2.
2023-04-21 15:03:20 +00:00
Svyatoslav Kuzmich 7c2fa3290e [Wasm] Revert removal of some Dynamic functions
Deprecate them with ERROR instead to improve compiler messages
2023-04-21 15:03:19 +00:00
Filipp Zhinkin 50841e7cb0 KT-42589 Add listOf, setOf, mapOf overloads for a single value to common src-set
`listOf`, `setOf` and `mapOf` overloads were defined in some source-sets
but common source-set was missing it.
This change adds common definition of these methods and also add
declarations for source-sets that were previously
missing it.

^KT-42589 fixed
2023-04-20 08:42:15 +00:00
Ivan Kylchik 2e836494f5 Rewrite primitives' generation using simple DSL 2023-04-20 08:18:58 +00:00
Ivan Kylchik dd0267f4ad [WASM] Mark necessary methods that must be evaluated at compile-time
It includes methods and properties from Boolean, Char, String,
Enum and KCallable.
2023-04-20 08:18:58 +00:00
Ivan Kylchik 695229e288 [JS] Mark necessary methods that must be evaluated at compile-time
It includes methods and properties from Boolean, Char, String,
Enum and KCallable.
2023-04-20 08:18:57 +00:00
Ivan Kylchik 07ca981632 Unify generation of Primitives files for all backends 2023-04-20 08:18:57 +00:00
Abduqodiri Qurbonzoda da0cc2ea4d [K/N] Deprecate Char.MIN_RADIX and MAX_RADIX constants
As a part of efforts to stabilize Native stdlib.
2023-04-19 20:33:33 +00:00
Abduqodiri Qurbonzoda b25f3be81b [K/N] Experimental Char code point constants and functions
Internalize WASM Char code point functions.

As a part of efforts to stabilize Native stdlib.
2023-04-19 20:33:33 +00:00
Abduqodiri Qurbonzoda c6eaadb44f [WASM] Internalize MutableList.replaceAll function
It will be introduced later in Common: KT-57152.
2023-04-19 20:32:56 +00:00
Abduqodiri Qurbonzoda 954e11c265 [K/N] Mark MutableList.replaceAll with ExperimentalNativeApi
As a part of efforts to stabilize Native stdlib #KT-55765.
2023-04-19 20:32:55 +00:00
Abduqodiri Qurbonzoda 040fcee04e [K/JS] Loosen StringBuilder.capacity() deprecation level to WARNING 2023-04-19 20:20:43 +00:00
Abduqodiri Qurbonzoda 88181404df [K/N] Remove deprecation from StringBuilder.capacity() function
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:43 +00:00
Abduqodiri Qurbonzoda 208b279d2b [K/N] Internalize CharCategory.value/valueOf
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:42 +00:00
Abduqodiri Qurbonzoda 7eba68e62b [K/N] Commonize String.regionMatches function
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:42 +00:00
Abduqodiri Qurbonzoda 0d31b0d12c [K/N] Internalize RegexOption.value/mask properties
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:42 +00:00
Abduqodiri Qurbonzoda 3a4a00ef84 [K/N] Fix MatchGroup.range documentation
As a part of efforts to stabilize K/N stdlib.
2023-04-19 20:20:41 +00:00
Abduqodiri Qurbonzoda c1fb6528aa [WASM] Introduce internal ExperimentalNativeApi
To be able to OptIn usages in shared native-wasm directory.
2023-04-19 19:02:14 +00:00
Abduqodiri Qurbonzoda b6c2ce2dc8 [K/N] Make assert functions experimental with ExperimentalNativeApi 2023-04-19 19:02:14 +00:00
Vsevolod Tolstopyatov af9252aa96 Mark all Worker-related API as obsolete.
* Explain what obsolete means and why workers are obsolete
* Add some documentation to workers to explain its common pitfalls

^KT-54702


Merge-request: KT-MR-9563
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2023-04-19 09:28:23 +00:00
Ilya Gorbunov 0c1afcac67 KT-58046 Wrap hrtime array reading into a class
To achieve nice toString and proper equals/hashCode semantics of ValueTimeMark
2023-04-18 15:25:31 +00:00
Ilya Gorbunov 1014434475 KT-58046 Use saturated math in LongTimeMark implementation
- keep offset in range (-1..+1) of time source units
- when adding big or infinite offset, saturate startedAt instead
- displace initial reading to zero, similar to MonotonicTimeSource
- fix the zero reading in TestTimeSource by calling markNow in constructor
- use more precise reading adjustment in TestTimeSource for big durations
- add a note about comparable time marks for AbstractLongTimeSource and TestTimeSource
2023-04-18 15:25:31 +00:00
Ilya Gorbunov 7a6947ad35 KT-58046 Generalize saturating duration math to arbitrary units 2023-04-18 15:25:31 +00:00
Ilya Gorbunov 17d977977c KT-58058 Duration truncation internal helper function 2023-04-18 15:25:30 +00:00
Zalim Bashorov 521a272acb [Wasm] Pass js stack value directly when replacing a wasm exception with JS one
In this case, we don't need to convert a value to and from wasm String.
2023-04-17 16:15:22 +00:00
Zalim Bashorov 6bfd1e7e9f [Wasm] Stop using unsigned numbers in ScopedMemoryAllocator
It turned out that using unsigned numbers is heavy both in terms of size and performance.
We can consider switching back (KT-58041) as soon as we implement unsigned numbers and operations using wasm built-in capabilities (KT-58039).
2023-04-17 16:15:22 +00:00
Filipp Zhinkin 368f21461c KT-55091 Optimize Sequence::toSet/toList implementation
Sequence::toSet and Sequence::toList both create a
collection, fill it with elements, and then try to optimize a result
by returning empty, singleton, or the allocated collection depending on
the elements count.
Instead of allocating the collection and then trying to return
an optimized instance it is worth checking the sequence's size
beforehand and return empty/singleton collection when possible.

Proposed change optimize performance of aforementioned functions and
also reduce allocation rate when a sequence consists of 0 or 1 elements.

^KT-55091 fixed
2023-04-17 08:58:20 +00:00
Alexander Korepanov e8be3043cc [JS IR] Allow restriction of function argument by external type
Add a special annotation @JsExternalTypeArgument for
 marking function parameters. The marked parameter
 accepts an argument with an external type only.

^KT-57479 Fixed
2023-04-17 08:21:10 +00:00
Abduqodiri Qurbonzoda 8629c92c62 Update copyright of generatedUnicodeData files 2023-04-12 23:28:12 +00:00
Iaroslav Postovalov fb80c0cb0d Override toString function in stdlib delegates
Co-authored-by: ilya-g <ilya.gorbunov@jetbrains.com>
2023-04-11 14:46:29 +00:00
Abduqodiri Qurbonzoda c961c15729 Commonize AssertionError(message, cause) constructor 2023-04-11 13:32:54 +00:00
Filipp Zhinkin d0847f2519 KT-57617 Delegate iterators of reversed list views to underlying list iterators
Improve the performance of reversed list view iterators by delegating to
underlying list iterators instead of using implementations provided by
the AbstractList.
Latter use AbstractList::get(index: Int) to implement next() and
previous() methods and depending on the underlying list's implementation
it may lead to worse performance.

The change also improves reversed list views test coverage.
2023-04-11 08:16:21 +00:00