Commit Graph

1151 Commits

Author SHA1 Message Date
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
Ilya Gorbunov 2dbff89098 Split tests for MutableList.shuffle and Iterable.shuffled 2023-04-08 14:47:30 +00:00
Ilya Gorbunov f13e127b0f KT-57607 Add test for MutableList.addAll at index
Also improve other operations test coverage
2023-04-08 14:47:30 +00:00
Igor Yakovlev 5a46cb1c40 [Wasm] Fix invalid float and double sign parser for '-Infinity' value 2023-04-04 18:39:18 +00:00
Ilya Chernikov 1d72681e4e K2: Fix stdlib test use of assertEquals
fixes test compilation according to the workaround
described in #KT-56717
2023-03-08 09:38:48 +00:00
Ilya Chernikov 8a8b204e11 K2, stdlib tests: make unsigned conversions explicit
Allow using K2 to compile stdlib tests
related to #KT-56379
2023-03-08 09:38:47 +00:00
Abduqodiri Qurbonzoda dc03a03762 Introduce basic, url-safe and mime Base64 variants #KT-9823 2023-01-16 11:24:49 +00:00
Igor Yakovlev 35340f2f04 [Wasm] Fix stdlib String to Float parse 2022-12-29 11:57:47 +00:00
Abduqodiri Qurbonzoda fff593492d Introduce Common AutoCloseable & use #KT-31066
Co-authored-by: Ilya Gorbunov <Ilya.Gorbunov@jetbrains.com>

Merge-request: KT-MR-8113
Merged-by: Abduqodiri Qurbonzoda <abduqodiri.qurbonzoda@jetbrains.com>
2022-12-27 11:50:22 +00:00
Ilya Gorbunov e35ace5d3a Deprecate AbstractDoubleTimeSource
There are too few usages of it, and it can be mostly replaced with AbstractLongTimeSource.
2022-09-19 19:16:40 +00:00
Ilya Gorbunov 57c9d61291 ComparableTimeMark and specialized TimeSource KT-54082
- Introduce ComparableTimeMark interface extending TimeMark,
and TimeSource.WithComparableMarks - a time source that returns such time marks.
- Implement ComparableTimeMark in ValueTimeMark and AbstractLong/DoubleTimeMark classes.
2022-09-19 19:16:40 +00:00
Abduqodiri Qurbonzoda 0db9326105 Introduce a deprecated StringBuilder.append(CharArray, Int, Int) in Common #KT-52336 2022-09-08 14:34:38 +00:00
Abduqodiri Qurbonzoda faedd76b32 Remove deprecation from ConcurrentModificationException constructors #KT-53927
The constructors were introduced in jdk7,
thus their usage was prohibited in Common code.
Now that jvmTarget is 1.8 and jdk8+ is used to compile stdlib,
these constructors are available on all platforms.
2022-09-08 14:01:09 +00:00
Ilya Gorbunov 8b95257143 Reduce the chance shuffle produces an identical permutation in test (part 2) 2022-08-29 22:14:24 +02:00
Vsevolod Tolstopyatov 5054e301be [stdlib] Improve EnumEntries
* Provide short-circuit methods for contract "EnumEntries contains all
  enum entries"
* Make EnumEntries serializable
* Introduce more convenient overload for other backends

#KT-53152


Merge-request: KT-MR-6867
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2022-08-22 16:50:28 +00:00
Abduqodiri Qurbonzoda 6c4777dcdd Fix JDK-dependent stdlib tests after advancing jvmTarget 2022-08-17 22:55:43 +03:00
Ilya Gorbunov 1addc23b23 Add range iteration tests for rangeUntil
#KT-52932
2022-07-26 23:52:10 +00:00
Ilya Gorbunov 721508f6dd Add several equality tests for empty open ranges 2022-07-26 18:42:30 +00:00