Commit Graph

1567 Commits

Author SHA1 Message Date
takattata f06ea6fddd KT-20357 Add sample code for Char extensions 2018-09-26 21:58:50 +03:00
Takayuki Matsubara d26c0f777b KT-20357 Add samples for Map.containsValue
Co-authored-by: Ilya Gorbunov <ilya.gorbunov@jetbrains.com>
2018-09-26 21:03:57 +03:00
Keita Watanabe 12ec4fdce0 KT-20357 Add sample for mutableSet function 2018-09-26 20:44:40 +03:00
Ilya Gorbunov 7b66a4d295 Remove links to contract samples as these samples are not supported by Dokka 2018-09-26 18:15:52 +03:00
Ilya Gorbunov b2b23ac282 Improve contract API documentation 2018-09-26 18:15:52 +03:00
Ilya Gorbunov f2a51f96a5 Improve documentation of experimental annotations 2018-09-26 18:15:52 +03:00
Yuki Miida af1fc5b668 Add sample for orEmpty method 2018-09-26 05:54:40 +03:00
Ilya Gorbunov d793221a7b Extract unsigned type related extensions to separate classes
- Rename class with unsigned number to string conversions to UStringsKt
- Extract Random unsigned extensions to URandomKt
2018-09-18 22:25:36 +03:00
Mikhail Zarechenskiy a293aded5d Introduce builder-like inference with an explicit opt-in for it
- Add marker for the experimental type inference features
 - Add annotation that will control builder-like inference
 - Require that annotation on corresponding parameters and extensions
 - Allow to use builder inference without suspendability

 Changes in tests and refactorings (rename mainly) are going to be
 introduced in further commits
2018-09-18 18:55:25 +03:00
Ilya Gorbunov f4af656e20 Remove entire stdlib opt-in for unsigned types to control precisely where they are exposed 2018-09-17 17:58:27 +03:00
Ilya Gorbunov aac96c476a Rename sequence and iterator builder functions and their scope class
This introduces new functions instead of the existing sequence builders:
- `sequence` instead of `buildSequence`
- `iterator` instead of `buildIterator`
- `SequenceScope` instead of `SequenceBuilder`

The old functions were deprecated with error and made inline-only, and `SequenceBuilder` has been
made a deprecated typealias to `SequenceScope`.

Move sequence builders to `SequencesKt` facade class.

Replace sequence builder usages in stdlib and samples.

#KT-26678
2018-09-16 23:30:35 +03:00
Ilya Gorbunov b1c2daf1fe Stdlib: fix name shadowing and names of overridden method parameters 2018-09-14 15:32:25 +03:00
Ilya Gorbunov bf4be12239 Stdlib: review and suppress warnings 2018-09-14 15:32:25 +03:00
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 928fe19801 Rename Random.next* parameters: remaining renames
- Correct docs after parameter renaming
- Rename parameters in Random inheritors
- Rename local variables

#KT-26596
2018-09-14 15:15:52 +03:00
kenji tomita ffb83bbdf0 Rename Random.next* parameters from "origin, bound" to "from, until"
Rename Random test methods

#KT-26596
2018-09-14 15:15:52 +03:00
Ilya Gorbunov 9353cfb526 contentDeepToString: use list instead of set for infinite recursion tracking
#KT-26388
2018-09-13 06:10:10 +03:00
Ilya Gorbunov 2d356b89b5 Specialize contentDeepEquals/HashCode/ToString for arrays of unsigned types
#KT-26388
2018-09-13 06:10:10 +03:00
victor.petukhov 50d9dbbfc1 Fix inheritance in stdlib contracts code (KT-26409) 2018-09-12 12:34:15 +03:00
Ilya Gorbunov 000e7493a1 Introduce common KCallable and K(Mutable)Property(ø,0,1,2) interfaces
#KT-25935
2018-09-11 19:21:15 +03:00
Ilya Gorbunov 7b46d22877 Introduce common KClass interface #KT-25935 2018-09-11 18:45:55 +03:00
Ilya Gorbunov 1a8b258d86 Raise deprecation level for map delegation accessor according to #KT-18789
#KT-21703
2018-09-11 18:15:03 +03:00
victor.petukhov 8f209fa667 Add documentation to contracts stdlib code 2018-09-11 18:03:38 +03:00
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
Ilya Gorbunov 48fd8a63ee Introduce Any?.hashCode() extension #KT-25039 2018-09-10 06:41:49 +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 ce7a863843 Move OptionalExpectation and related annotations to another source root 2018-08-31 04:17:42 +03:00
Ilya Gorbunov 9c412ba436 Fix incorrect range transform in nextUInt/nextULong with range parameter
#KT-25570
2018-08-30 16:21:33 +03:00
Ilya Gorbunov d035c2690a Random extensions for unsigned: fixes after review
#KT-25570
2018-08-30 16:21:01 +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 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 6400687f2a Restore experimental SequenceBuilder 2018-08-30 14:58:07 +03:00
Ilya Gorbunov 0ceceaaa6a Restore history of SequenceBuilder from experimental coroutines 2018-08-30 14:58:05 +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 c44f62a3d4 Allow dropping and taking a lot of elements in very long sequences
For example allow dropping and taking Int.MAX_VALUE elements from
a sequence that is a result of another Int.MAX_VALUE dropping.
2018-08-30 14:57:03 +03:00
Ilya Gorbunov cd0906a357 Improve isNullOrEmpty() extensions
- Annotate with SinceKotlin("1.3") and InlineOnly
- Add contract linking the receiver and the returned value
- Unify wording in docs
- Add sample for Map.isNullOrEmpty

#KT-23279
2018-08-30 14:51:02 +03:00
Mon_chi d0788148e2 Add isNullOrEmpty() to Array, Collection, and Map. Fixes KT-23279 2018-08-30 14:51:00 +03:00
Jeff Wright 292f69936b Add Collections.isNullOrEmpty #KT-23279 2018-08-30 14:50:58 +03:00
Toshiaki Kameyama c4b785de36 Add Sequence.orEmpty #KT-16552 Fixed 2018-08-30 14:50:54 +03:00
Ilya Gorbunov 2ce0bca34e Make bound check helpers top-level so they are compiled as static on JVM
Improve empty range exception text in nextInt/nextLong(range)
2018-08-30 14:50:52 +03:00
Ilya Gorbunov 35c927214d More efficient double generation in JS 2018-08-30 14:50:50 +03:00
Ilya Gorbunov b96803248f Write random contract tests and fix implementations to pass them 2018-08-30 14:50:48 +03:00
Ilya Gorbunov ed1f869354 Add xorwow random implementation test and fix implementation 2018-08-30 14:50:46 +03:00
Ilya Gorbunov 870f5e3448 Remove lazy initialization of default platform random 2018-08-30 14:50:42 +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 0f5f90cf52 Advance project version to 1.3-SNAPSHOT
Set LATEST_STABLE language version and current version of stdlib to 1.3, set IS_PRE_RELEASE
Remove "EXPERIMENTAL" from 1.3 version description in tests and gradle options
2018-08-30 14:49:27 +03:00