Commit Graph

168 Commits

Author SHA1 Message Date
Ilya Gorbunov
7e0a658de7 Change nextInt/Long with range parameters from members to extensions
We'd like to fix the implementation of these methods, so we could intrinsify them later
or perform other optimizations that are not possible when these methods are open.
2018-09-14 15:15:52 +03:00
Ilya Gorbunov
2d356b89b5 Specialize contentDeepEquals/HashCode/ToString for arrays of unsigned types
#KT-26388
2018-09-13 06:10:10 +03:00
Ilmir Usmanov
273889d1a9 Add our own primitive boxing methods to stdlib
These methods are very thin wrappers around primitive wrapper classes
constructors.
They are used by coroutines code which returns primitives and this way
HotSpot is able to throw the allocations away completely.
 #KT-26591 Fixed
2018-09-12 15:36:11 +03:00
victor.petukhov
50d9dbbfc1 Fix inheritance in stdlib contracts code (KT-26409) 2018-09-12 12:34:15 +03:00
Roman Elizarov
e2713501ce Rename SuccessOrFailure to Result and hide Failure from ABI
* The members of Result are isSuccess, isFailure, exceptionOrNull, getOrNull
* The rest of API is implemented via inline-only extensions
* There are two internal functions to hide detailed mechanics of an internal
  Result.Failure class: createFailure and throwOnFailure
* Result.toString is explicit: either Success(v) or Failure(x)

See KT-26538
2018-09-09 11:34:31 +03:00
Ilya Gorbunov
df9f77909b Make experimental COROUTINE_SUSPENDED refer to corresponding release one
Partially reverts commit 20c7a97.
Apply workaround for KT-25003 once again for the new COROUTINE_SUSPENDED
2018-09-07 01:03:53 +03:00
Ilya Gorbunov
7f8863bfd0 Update public API after inline class generation schema was changed 2018-09-06 03:56:01 +03:00
Roman Elizarov
0401b4e0bb Coroutine context shall perform structural equality comparison on keys
Fixes KT-26398
2018-09-05 01:29:19 +03:00
Ilya Gorbunov
2091601fe8 Advance bootstrap to 1.3.0-dev-25
Update public API of specialized unsigned iterators.
2018-08-31 04:17:42 +03:00
Roman Elizarov
319c16c885 CoroutineStackFrame: public API dump updated 2018-08-30 16:21:49 +03:00
Ilya Gorbunov
ea2c33a532 Extension random() to select random element from a collection
Fixes #KT-15539
2018-08-30 16:21:27 +03:00
Ilya Gorbunov
ea37a65178 copyInto: copying elements between two arrays
#KT-25874 Fixed
2018-08-30 16:21:20 +03:00
Ilya Gorbunov
58e6f910bc Update public API after stopping SuccessOrFailure mangling in signatures 2018-08-30 16:21:17 +03:00
Kerooker
f9dec5e794 Implement extension functions for Random: nextUInt, nextULong and nextUBytes
Given there's a Random API in the stdlib, that generates all random primitives, this commit adds the possibility to generate random unsigned integers.
It uses the same implementation from Random.nextInt, nextLong and nextBytes, but uses the appropriate conversions from a signed type to an unsigned type.

The use of the same API guarantees that the distribution is uniform, but this commit adds some unit test to enforce that necessity.

Fixes #KT-25570
2018-08-30 16:20:58 +03:00
Ilya Gorbunov
3607ed85ab Update public API dump with mangled signatures 2018-08-30 16:20:45 +03:00
Ilya Gorbunov
e670318cf0 ifEmpty and isBlank extensions
- Introduce ifEmpty extension for Collections, Maps, Arrays, Sequences
- Introduce ifEmpty and isBlank for CharSequences

#KT-15695 Fixed
2018-08-30 16:20:42 +03:00
Dmitry Savvinov
accbd07b2e Publish ContractsDsl
- Mark @ContractsDsl as @Experimental
- Move Contracts DSL out from 'internal' package
- Change visibility of ContractsDsl from 'internal' to 'public'

^KT-25274 Fixed
^KT-25495 Fixed
2018-08-30 16:19:51 +03:00
Ilya Gorbunov
2530a8e98c Provide unsigned string to number conversion in arbitrary base
#KT-26161
2018-08-30 14:58:35 +03:00
Ilya Gorbunov
c1d1a7108f Provide unsigned number to string conversion in arbitrary base
#KT-26161
2018-08-30 14:58:33 +03:00
Ilya Gorbunov
4df665bc78 Generate extensions for unsigned arrays and provide tests for them
- contentEquals, contentToString, contentHashCode
- as[Signed]Array, as[Unsigned]Array
- to[Signed]Array, to[Unsigned]Array
- toTypedArray
- copyOf(), copyOf(newSize), copyOfRange(...)
2018-08-30 14:58:26 +03:00
Ilya Gorbunov
3d2eb36486 Generate until, downTo, step, reversed functions for unsigned ranges/progressions 2018-08-30 14:58:20 +03:00
Ilya Gorbunov
f367322084 Introduce associateWith and associateWithTo functions
#KT-13814
2018-08-30 14:58:14 +03:00
Ilmir Usmanov
b7b5fd75b8 Minor. Fix tests 2018-08-30 14:57:50 +03:00
Denis Zharkov
c12bfe312a Make experimental/release COROUTINE_SUSPENDED reference the same instance
It's necessary when mixing experimental/release coroutines together

 #KT-25683 In Progress
2018-08-30 14:57:44 +03:00
Ilya Gorbunov
357c5be4fb Make sure index and count do not overflow for long sequences
Throw an exception immediately before an overflow becomes observable.
Place check to prevent negative index from indexOf, indexOfFirst.
Do not insert overflow checks for arrays, lists, maps and char sequences.

#KT-16097
2018-08-30 14:57:05 +03:00
Alexander Udalov
ceb909d261 Inherit KType from KAnnotatedElement, implement KType.annotations
#KT-16795 Fixed
2018-08-30 14:56:57 +03:00
Ilya Gorbunov
a0b0994651 Make unsigned array constructor-like functions inline-only 2018-08-30 14:56:53 +03:00
Ilya Gorbunov
f9479d12f9 Add missing unsigned array constructors (from size)
#KT-25961 Fixed
2018-08-30 14:56:51 +03:00
Ilya Gorbunov
282cf73aff Update public API: inline classes codegen changes 2018-08-30 14:56:48 +03:00
Ilya Gorbunov
85af1f5d38 Improve argument validation in copyOfRange
Make copyOfRange implementation non-inline in order not to expose
copyOfRangeToIndexCheck implementation detail.

It will be possible to make the function non-inline itself later without
that JvmName trick, when apiVersion 1.2 support is discontinued.

#KT-19489
2018-08-30 14:56:29 +03:00
Ilya Gorbunov
17e04b2665 Deprecate readBytes with estimatedSize parameter, add overload without parameters
Add a test for readBytes.

#KT-19305 Fixed
2018-08-30 14:56:23 +03:00
Alexander Udalov
cbc92bc9a1 Add KClass.sealedSubclasses to get direct subclasses of sealed class
#KT-14657 Fixed
2018-08-30 14:56:21 +03:00
Ilya Gorbunov
1792a77a47 Generate hashCode and equals for unsigned types 2018-08-30 14:52:51 +03:00
Alexander Udalov
082da82f3e Introduce kotlin.jvm.functions.FunctionN
#KT-13764
2018-08-30 14:52:36 +03:00
Alexander Udalov
e35ebff4e1 Move superinterface to the only subclass of FunctionBase 2018-08-30 14:51:17 +03:00
Ilya Gorbunov
07a0cb91d4 Introduce Char.MIN_VALUE and MAX_VALUE constants (KT-21763)
Add Char.MIN_VALUE and Char.MAX_VALUE implementations in primitive companion objects.
Update builtins test data and public API.

Co-authored-by: Oskar Drozda <themppsplx@gmail.com>
2018-08-30 14:51:14 +03:00
Ilya Gorbunov
0c50014e7a Introduce SIZE_BYTES and SIZE_BITS constants for all integral types
#KT-8247 Fixed
2018-08-30 14:51:10 +03:00
Kerooker
af5f78076c KT-7922 Added Boolean Companion Object 2018-08-30 14:51:04 +03:00
Ilya Gorbunov
fa33b1b5a9 Random docs and API refinement
KT-17261
2018-08-30 14:50:40 +03:00
Ilya Gorbunov
7e4528e217 Common shuffle/shuffled with the specified random source
KT-17261, KT-9010
2018-08-30 14:50:38 +03:00
Ilya Gorbunov
cc031e3a40 Provide common Random API
#KT-17261
2018-08-30 14:50:36 +03:00
Ilya Gorbunov
bbee18b84d Introduce StringBuilder.clear() extension
#KT-18910 Fixed
2018-08-30 14:50:29 +03:00
Alexander Udalov
f423403167 Make kotlin.Metadata public
Prohibit explicit usage of `@Metadata` to prevent possible
AnnotationFormatError at runtime

 #KT-23602 Fixed
2018-08-30 14:50:25 +03:00
Ilya Gorbunov
b160561795 Include new coroutines and unsigned classes into stdlib
Fix clashing module name in common coroutines sourceset
2018-08-30 14:50:21 +03:00
Denis Zharkov
4bf51af2fa Fix reference-public-api
It's necessary because of the changes in 3497880f203449121ea8035c49b792cc4dc53bd6
2018-07-09 15:27:19 +03:00
Alexander Udalov
bf3419c3bd Introduce OptionalExpectation for annotations missing on some platforms
This commits adds a new annotation OptionalExpectation to the standard
library, which is experimental. To enable its usage, either pass
'-Xuse-experimental=kotlin.ExperimentalMultiplatform' as a compiler
argument, or '-Xuse-experimental=kotlin.Experimental' and also annotate
each usage with `@UseExperimental(ExperimentalMultiplatform::class)`

 #KT-18882 Fixed
2018-05-24 13:14:51 +02:00
Ilmir Usmanov
5e4ce4f880 Remove coroutineContext from kotlin.coroutines.experimental.intrinsics package
#KT-22400: Fixed
2018-05-07 10:28:54 +03:00
Alexander Udalov
4f53a54115 Drop Experimental.Impact, simplify related code and tests
See https://github.com/Kotlin/KEEP/issues/95#issuecomment-383889404

Drop Experimental.changesMayBreak, Experimental.Impact, the concept of
signature/body usage, same module exemption. Make the majority of tests
single-module because there is now no difference in the checker between
usages from the same module or from another module
2018-05-04 13:48:24 +02:00
Ilya Gorbunov
ae62cd6570 Do not produce original kotlin-stdlib public api dump anymore
It was produced from the kotlin-stdlib of 1.0 which was separate from the kotlin-runtime.
The actual dump is in kotlin-stdlib-runtime-merged.txt
2018-04-12 17:53:00 +03:00
Mikhael Bogdanov
be33a9bf3b Update test data 2018-04-04 14:55:39 +02:00