1168 Commits

Author SHA1 Message Date
Abduqodiri Qurbonzoda 65cfc578a8 Introduce constructor-like function for AutoCloseable #KT-66102 2024-02-27 20:52:49 +00:00
Ilya Gorbunov 0ecbbbf1ca [stdlib] Set AV to 2.0, LV to 1.9 for main compilations, build tests with K2 2024-02-21 16:28:12 +00:00
Ilya Gorbunov 709076acc9 [stdlib] Improve documentation of Char.isWhitespace and test it behaves the same in different targets 2024-02-20 03:48:08 +00:00
Abduqodiri Qurbonzoda 5b703c57ec Fix a test failure caused by KT-52181 2024-02-08 07:46:09 +00:00
Abduqodiri Qurbonzoda 600e306d80 Fix JS Map.keys.remove return value #KT-65525 2024-02-08 07:46:09 +00:00
Abduqodiri Qurbonzoda c9d8ecc599 Detect concurrent modifications in ArrayDeque #KT-63355
Remove the ArrayDeque.subList().subList() test for comodification detection.
For types that extend AbstractList and to not override subList function,
the behavior varies depending on JDK version. With JKD8, the test fails for ArrayDeque.
While with JDK9+, it passes.
2024-01-31 12:11:48 +00:00
Abduqodiri Qurbonzoda b67ebf36a2 Implement optimized removeRange for ArrayDeque #KT-64956
Test ArrayDeque with size 15. With the existing sizes the removeRange
implementation couldn't reach the maximum number of iterations - 3.

Benchmark results for ArrayDeque.subList().clear() that uses
removeRange() can be found here:
https://github.com/qurbonzoda/KotlinArrayDequeBenchmarks/tree/master/results
2024-01-30 22:37:25 +00:00
Igor Yakovlev 3e9b2573c5 [Wasm/std] Fix invalid sign for FP rem operator
Fixed #KT-64829
2024-01-24 15:40:48 +00:00
Troels Bjerre Lund 5a8faa8775 Align ListBuilder with native ArrayList
Furthermore, add test for ListBuilder.subList detection of concurrent
modification, and fix error in ListBuilder and ArrayList.

Fix KT-62346
2023-11-14 09:47:25 +00:00
Alexander Shabalin fa9c620261 [K/N] Migrate some runtime/basic tests to new testing infra ^KT-61259 2023-11-10 15:51:05 +00:00
Abduqodiri Qurbonzoda ba374bb45c Optimize hex formatting and parsing implementation #KT-58218
Merge-request: KT-MR-11702
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-09-08 22:40:56 +00:00
Abduqodiri Qurbonzoda 84c6333b23 Introduce Common String.toCharArray(destination) #KT-60657
Merge-request: KT-MR-11340
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-08-25 03:11:13 +00:00
Igor Yakovlev 983991d46c [Wasm] Add box and stdlib tests in wasi mode 2023-08-08 18:10:19 +02:00
Abduqodiri Qurbonzoda 6fdfd4e8dd Null-terminate Collection.toArray destination only in JVM
In other platforms the elements following the collection elements
should not be changed.

As a part of efforts to stabilize Native stdlib.
2023-07-27 11:16:58 +00:00
Abduqodiri Qurbonzoda df16fa3306 [K/N] Regex matching zero length should split surrogate pairs #KT-57401
Merge-request: KT-MR-11110
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-07-26 14:19:25 +00:00
Abduqodiri Qurbonzoda db908aefff Detect concurrent modification of the parent list in subList
As a part of efforts to stabilize Native stdlib.
2023-07-25 16:00:42 +00:00
Abduqodiri Qurbonzoda 0bc74967b5 Rename testThrowsCME to testIteratorThrowsCME in tests 2023-07-25 16:00:42 +00:00
Alexander Korepanov ad3583ac38 [JS IR] Fix KClass equals for Nothing type 2023-07-21 14:48:30 +00:00
Alexander Korepanov bfb7f74e47 [JS IR] Add linkedHashMap tests
^KT-59001
2023-07-21 14:48:29 +00:00
Alexander Korepanov 0b4a9499f0 [JS IR] Catch concurrent modifications of HashMap
^KT-59001
2023-07-21 14:48:29 +00:00
Abduqodiri Qurbonzoda f152fa537d Collection.toString() should not throw if it contains itself
Merge-request: KT-MR-10591
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-07-11 09:58:38 +00:00
Vsevolod Tolstopyatov 37c2c862d8 KT-53154 enumEntries experimental intrinsic stub
Provide an inefficient default implementation and make it "@PublishedApi internal" so it can be safely merged as is.

Intrinsics will be added later in follow-up PRs, and then the implementation will be adjusted accordingly

Merge-request: KT-MR-10843
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2023-06-28 20:25:11 +00:00
Abduqodiri Qurbonzoda bf1c9774aa Fix the ConcurrentModification test that fails in jdk9+
Modification registration seems to changed in Java 9. Now if the asked
capacity in `ensureCapacity` function is less than current capacity,
no modification is registered.
2023-06-28 19:00:46 +00:00
Vsevolod Tolstopyatov 175cf5e833 KT-53327 replace Enum.values() with Enum.entries in CharCategory
Also, replace it in stdlib tests where appropriate and disable already unsupported legacy JS tests


^KT-53327 fixed

Co-authored-by: Artem Kobzar <Artem.Kobzar@jetbrains.com>

Merge-request: KT-MR-10632
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2023-06-21 14:40:16 +00:00
Abduqodiri Qurbonzoda af1630e270 [K/N] Catch concurrent modifications of HashMap
As a part of efforts to stabilize Native stdlib.
2023-06-20 18:35:39 +00:00
Abduqodiri Qurbonzoda 9d8d9d000f [K/N] Catch concurrent modifications of ArrayList
As a part of efforts to stabilize Native stdlib.
2023-06-20 18:35:39 +00:00
Abduqodiri Qurbonzoda 9f16daac02 [WASM] Throw IllegalArgumentException on negative array size 2023-06-20 16:31:59 +00:00
Abduqodiri Qurbonzoda e802ee05a7 [K/N] Do not override equals/hashCode for AbstractMutableMap.values collection 2023-06-19 11:41:10 +00:00
Abduqodiri Qurbonzoda 4ae19b2b44 [K/N] Deprecate SharedImmutable annotation #KT-57837
As a part of efforts to stabilize Native stdlib.
2023-06-19 11:35:32 +00:00
Abduqodiri Qurbonzoda 830c78773c Align behavoir of collection constructors across platforms #KT-59192
The initialCapacity should be non-negative and loadFactor should be positive.

As a part of efforts to stabilize Native stdlib.
2023-06-08 12:41:40 +00:00
Abduqodiri Qurbonzoda 89d1cfe05b [K/N] ArrayList.ensureCapacity() should ignore negative arguments 2023-06-06 18:11:57 +00:00
Abduqodiri Qurbonzoda ae394caf42 [K/N] Throw OutOfMemoryError when StringBuilder overflows 2023-06-06 18:11:57 +00:00
Abduqodiri Qurbonzoda 2ef50f8c34 Move ArrayDeque.newCapacity to AbstractList 2023-06-06 18:11:57 +00:00
Abduqodiri Qurbonzoda 7acaf6e473 [K/N] String.indexOf matches byte sequences not on the char boundary #KT-56637
If the found index is odd, retry search from index + 1.

Merge-request: KT-MR-10364
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2023-06-01 12:56:32 +00:00
Ilya Gorbunov e11ebcadb4 Test refactor: extract big duration adjustment to a separate test 2023-05-31 04:45:15 +00:00
Ilya Gorbunov f8f3862f0c Make TimeMark adjustment test more stable 2023-05-31 04:45:15 +00:00
Ilya Gorbunov bbb36ce501 KT-58046 Promote time sources, time marks, measureTime to stable 2023-05-16 11:42:32 +00:00
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
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
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
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
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 17d977977c KT-58058 Duration truncation internal helper function 2023-04-18 15:25:30 +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
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