Commit Graph

121 Commits

Author SHA1 Message Date
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
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 bbee18b84d Introduce StringBuilder.clear() extension
#KT-18910 Fixed
2018-08-30 14:50:29 +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
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
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
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
Ilya Gorbunov 0eae27e03f Add samples for zip on sequences and strings 2018-04-20 02:00:36 +03:00
TakuyaKodama 2d4e591b5d Add samples for zip on arrays and collections
Write the sample references in the template and run the generator
2018-04-20 02:00:36 +03:00
Ilya Gorbunov 9dd87d89ba Remove default values in actual functions that have default values in expect
Remove suppressions about default values in expect declarations
2018-04-12 17:53:00 +03:00
Ilya Gorbunov f7b2eba680 Do not mix expect/non-expect overloads of minOf/maxOf
Workaround for KT-22520
2018-04-12 17:53:00 +03:00
Ilya Gorbunov 912c69aaa3 Suppress expect-actual mismatch for relaxed array extensions
Due to KT-21937
2018-04-12 17:53:00 +03:00
Ilya Gorbunov 1be55db681 stdlib-common: remove common migration typealias for Volatile annotation
Otherwise it gets to jvm stdlib as new API.
2018-04-12 17:53:00 +03:00
Ilya Gorbunov 0164f9b730 stdlib-common: correct common exception type declarations 2018-04-12 17:53:00 +03:00
Ilya Gorbunov 10be42ddaa stdlib-common: suppress missing Comparator SAM constructor in JVM 2018-04-12 17:53:00 +03:00
Ilya Gorbunov d97707d6f7 Add JvmMultifileClass to preserve public API surface 2018-04-12 17:53:00 +03:00
Ilya Gorbunov 69ebb3bfb0 Switch to the new stdlib source generation scheme
Remove old generated sources for stdlib-jvm and stdlib-js
2018-04-12 17:53:00 +03:00
Ilya Gorbunov 70236d4824 Build standard library for JVM from a single source set
Add explicit imports for kotlin.* and kotlin.text.* to prevent typealiases
conflicting with their aliased types from default imports.
2018-04-12 17:53:00 +03:00
gzoritchak 1c1fe10e12 Add samples for take* and drop* extensions (KT-20357)
- Add samples for take, takeLast, takeWhile, takeLastWhile
- Add samples for drop, dropLast, dropWhile, dropLastWhile
2018-02-20 19:24:27 +03:00
Yuta Sakata 4926b5a4c0 Add samples for any, all and none
Rewrite samples to make them working on sample generator

Move location of the class that contains samples of Aggregates.kt
2018-02-19 18:44:28 +03:00
gzoritchak f790635b30 Add samples for joinTo
KT-20357
2018-02-18 20:12:05 +03:00
gzoritchak 40e3159463 Add samples for joinToString
KT-20357
2018-02-18 20:12:05 +03:00
Yanis Batura 9c8c1cdc18 Fix a couple of typos in docs and ReadMe
* Fix a couple of typos
- In the main ReadMe.md
- In onEach template's doc

* Update generated source code
2018-02-12 14:22:47 +03:00
Ilya Gorbunov b456c52902 Import kotlin.coroutines.experimental for generated sequences on all platforms
This will add import to common generated sources
2018-02-02 17:56:56 +03:00
Ilya Gorbunov 32b68ae1d5 Rearrange platform specialized functions
Place them according to their operation to ArrayOps and Filtering.
2018-01-24 02:10:05 +03:00
Ilya Gorbunov 6197c5bf7f Add sample for coerceIn with floating point range
#KT-20357
2018-01-11 09:05:28 +03:00
Ilya Gorbunov 8fc83e3ff5 Add samples for coerceIn, coerceAtLeast, coerceAtMost for comparable types
#KT-20357
2018-01-11 09:05:28 +03:00
shiraji 17573a3c21 Add samples for coerceIn
#KT-20357
2018-01-11 09:05:28 +03:00