Commit Graph

166 Commits

Author SHA1 Message Date
Ilya Gorbunov 1eda3805ec Introduce overloads to check for T? element contained in iterable range in a constant time
#KT-18483
2018-09-11 17:06:42 +03:00
Mikhail Zarechenskiy 106ecadd62 Allow using kotlin.Result as a return type in stdlib 2018-09-11 10:39:27 +03:00
Ilya Gorbunov 48add96e79 Deprecate mixed Int/FP contains operator for ranges
#KT-22423
2018-09-11 05:40:15 +03:00
Ilya Gorbunov 68c5c0f639 Introduce ConcurrentModificationException typealias in stdlib/jvm
This is required to provide the corresponding expect exception in stdlib/common.
Raise deprecation level for constructors declared in common but unsupported in JVM.

#KT-26598
2018-09-11 04:59:56 +03:00
Ilya Gorbunov e22ca022d4 Switch sourcesets of experimental and release coroutines
- Move experimental coroutines out of the main source root.
- Include experimental coroutines into the coroutines source set.
- Include release coroutines into the main source set.
2018-09-07 01:03:53 +03:00
Ilya Gorbunov 4344005fb5 Deprecate synchronized function in common stdlib #KT-26595 2018-09-06 21:15:31 +03:00
Mikhail Zarechenskiy 6c747dcdb2 Don't use constant conversion from signed to unsigned in stdlib
After daadba0927
2018-08-31 18:17:09 +03:00
Ilya Gorbunov 36f154882c Provide JvmSynthetic annotation in stdlib-common as optional
#KT-24478
2018-08-31 04:17:42 +03:00
Ilya Gorbunov 0c89996e34 Introduce platform specific annotations as optional in common stdlib
#KT-24478
2018-08-31 04:17:42 +03:00
Ilya Gorbunov ce7a863843 Move OptionalExpectation and related annotations to another source root 2018-08-31 04:17:42 +03:00
Ilya Gorbunov 009980944b Refine the exception type of EmptyRange.random()
Make it the same type as in case of an empty collection, so that
`emptyRange.random()` throws the same exception as `emptyRange.toList().random()`.

#KT-15539
2018-08-30 16:21:36 +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
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 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
Ilya Gorbunov a8596a9cd6 Rename experimental coroutines expect sources
In order not to clash in sources jar with expect sources of release coroutines
2018-08-30 14:57:14 +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
Ilya Gorbunov 2df78fc81a Introduce common ArithmeticException
Make divisionByZero test still fail in JS after introducing ArithmeticException
2018-08-30 14:56:59 +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 fa2f1311d7 Add tests for UInt, ULong
Opt-in to use unsigned types in tests
2018-08-30 14:55:41 +03:00
Ilya Gorbunov db7f4bb402 Deprecate js Math.random and provide replacement with Random.nextDouble
#KT-23564 Fixed
2018-08-30 14:52:47 +03:00
Ilya Gorbunov bbee18b84d Introduce StringBuilder.clear() extension
#KT-18910 Fixed
2018-08-30 14:50:29 +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
Ilya Gorbunov ed53983e1e Add support for CASE_INSENSITIVE_ORDER in JS and common
#KT-18067
2018-08-15 21:28:54 +03:00
Ilya Gorbunov 27dde5f730 String.compareTo: SinceKotlin in JS and common, restore default parameter value in JVM
Default parameter is required to generate docs with Dokka for now.

#KT-18067
2018-08-15 21:28:47 +03:00
Toshiaki Kameyama f05a19aafb JS stdlib: implement String.compareTo with ignoreCase
#KT-18067 Fixed
2018-08-15 21:28:44 +03:00
Bloder f89803fe8f Create samples for String.toLowerCase/toUpperCase
* Create toLowerCase method sample
* Create toUpperCase method sample
* Create toUpperCase sample reference in StringsJVM
* Create sample ref and doc of js impl toUpperCase
* Create sample ref and docs of js toLowerCase
* Add sample ref in toLowerCase expect fun
* Add sample ref in toUpperCase expect fun
2018-08-06 15:34:57 +03:00
Alexander Udalov 3323fd5a11 Check "kotlin" package usage when compiling common code
#KT-25369 Fixed
2018-07-26 17:10:33 +02:00
Dmitry Savvinov 668bd209f2 Use -Xallow-kotlin-package while compiling common sources
K2MetadataCompiler doesn't perform explicit check of compilation of
'kotlin' package, thus stdlib build wasn't passing '-Xallow-kotlin-package'.

However, we have special hack for compiling stdlib with contracts: if
'-Xallow-kotlin-package' is passed, then allow compiling contracts for
custom functions. We have to do it this way, because we don't want
stdlib artifacts to be marked with pre-release flag, even though
contracts for custom functions are not enabled yet
(see eae9923dbe).

Therefore, it's crucial to pass -Xallow-kotlin-package properly for that
side-effect.
2018-07-09 18:57:58 +03:00
Ilya Gorbunov b5fabf3f72 Make unsigned types experimental (with warning if not opted-in) 2018-07-04 19:12:11 +03:00
Ilya Gorbunov 615f57f2fc Compile unsigned types sourceset with 1.3 and annotate them with SinceKotlin("1.3") 2018-07-03 03:52:18 +03:00
Neonailol ede2e227c2 KT-23356 Cross-platform function to convert CharArray slice to String
Signed-off-by: Valeriy Zhirnov <neonailol@gmail.com>
2018-05-26 06:06:53 +03:00
Ilya Gorbunov 418db53ba4 Array.copyOf docs: do not use 'primitive default' term, rewrite description
#KT-22298
2018-05-25 21:52:36 +03:00
Valeriy Zhirnov 9239de9a02 KT-22298 Improve docs for Array.copyOf(newSize: Int)
Signed-off-by: Valeriy Zhirnov <neonailol@gmail.com>
2018-05-25 21:52:36 +03:00
Ilmir Usmanov 0cb73e55d0 Split kotlin-stdlib-coroutines into common and java jars
#KT-24532: Fixed
2018-05-25 18:19: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
Ilya Gorbunov e57e3971b6 Setup separate sourceset for unsigned integer types
Build jar with unsigned types and put it to dist
2018-05-22 22:26:20 +03:00
Yan Zhulanow c439b6d38b Pill: Import common modules as libraries 2018-05-15 16:29:47 +03:00
Florian Steitz d7bada0c29 [KT-10456] Added JS implementation for Int.toString(radix) and similar overloads 2018-05-11 15:42:11 +03:00
Ilya Gorbunov c53a2d57c3 Reformat stdlib: common code
#KT-5558
2018-04-27 00:50:16 +03:00
Ilya Gorbunov ad43c0f4cb Reformat stdlib: collections
#KT-5558
2018-04-27 00:49:06 +03:00
Ilya Gorbunov 502418e690 Put copyrights to the generated standard library sources
Read copyright template from .idea/copyright/apache.xml profile
2018-04-26 21:57:50 +03:00
Ilya Gorbunov e21c235bbb Add or update copyrights in the standard library sources 2018-04-26 21:57:50 +03:00
Ilya Gorbunov c239d346f7 Correctly indent upper bound separator in the generated stdlib code 2018-04-20 23:14:57 +03:00
Ilya Gorbunov 5381d0ed58 Move sequence operation classification higher than sample
Otherwise it gets eaten by that @sample tag.
2018-04-20 22:40:35 +03:00
Ilya Gorbunov 908d2d6975 Introduce kotlin-stdlib-generator dsl block for specifying sample reference 2018-04-20 22:40:35 +03:00
Ilya Gorbunov c5aed06110 Clarify docs for downTo and until 2018-04-20 05:25:31 +03:00
Ilya Gorbunov 501d969a38 Improve docs wording of zip function 2018-04-20 02:44:48 +03:00