Commit Graph

2259 Commits

Author SHA1 Message Date
Roman Elizarov 0401b4e0bb Coroutine context shall perform structural equality comparison on keys
Fixes KT-26398
2018-09-05 01:29:19 +03:00
Ilmir Usmanov cfc10ec061 Simplify debug metadata: instead of array of same values, store single element
This change is valid, since we want StackTraceElement to be as close
as possible to StackTraceElement of non-coroutine code.
Particularly, if the line is inside inlined function, its className,
functionName and sourceFile are inline site's ones, but lineNumber
is large, which is the way of representing inline function's line
numbers. The rest is handled by the plugin, which allows the user to choose
between inline function body and inline site.
2018-09-04 22:20:08 +03:00
Svyatoslav Kuzmich 197a5969e2 [JS IR BE] Fix stdlib files list for 1.3 2018-09-04 20:19:04 +03:00
Svyatoslav Kuzmich c3b9a5108e [JS IR BE] Add more stdlib files to runtime
Keep old sources list for coroutine tests
2018-09-04 20:19:04 +03:00
Svyatoslav Kuzmich a01b6de2d8 [JS IR BE] Add missing exceptions 2018-09-04 20:19:03 +03:00
Ilya Gorbunov 64996618b3 Suppress signed literals used as unsigned values in stdlib tests 2018-09-04 17:39:51 +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
Roman Artemev d1621b80cc Fake wrapped descriptors first working draft
get rid of descriptors in Bridge and Enum lowerings
Replace property accessors function type with IrSimpleFunction because they couldn't be constructors
get rid of descriptors in Callable reference lowering
refactored descriptor factory and inner class lowering
Add isReified property to IrTypeParameter declaration
keep getting rid of descriptors
Get rid of descriptors in Shared Variable Manager
LocalDeclarationLowering also uses no descriptors
Fix psi2ir
Fix nested classes names
Fix outer reference in inner classes
Fix name generator
get rid of descriptors in coroutines - something is working
Fix name generator
Fix unbound symbols in JVM BE
Rename DeclarationFactory members
2018-08-31 15:34:18 +03:00
Ilya Gorbunov 623adbfe4a Do not use JVM-specific annotations in pure-JS generated sources 2018-08-31 04:17:42 +03:00
Ilya Gorbunov 056db883c3 Fix JS IR runtime compilation for tests after applying OptionalExpectation
Jvm-specific actuals were removed from stdlib/js runtime.
Recreate them in irRuntime so they can be resolved when compiling runtime for IR tests.
2018-08-31 04:17:42 +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
Anton Bannykh e7f9727783 JS: fix tests related to 1.3 migration 2018-08-30 22:27:24 +03:00
Roman Elizarov a9eb94d822 Introduce CoroutineStackFrame interface for coroutine stack reconstruction in debugger
Fixes KT-26339
2018-08-30 16:21:46 +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 9c412ba436 Fix incorrect range transform in nextUInt/nextULong with range parameter
#KT-25570
2018-08-30 16:21:33 +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 b0bcd78e38 Optimize copying for typed arrays in JS 2018-08-30 16:21:24 +03:00
Ilya Gorbunov ea37a65178 copyInto: copying elements between two arrays
#KT-25874 Fixed
2018-08-30 16:21:20 +03:00
Ilya Gorbunov 9c4a74ce5b Improve stability of nextBoolean test
Increase number of tosses (according to the Law of Large Numbers).
2018-08-30 16:21:05 +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
Ilmir Usmanov e8597d706d Implement debug-friendly Continuation.toString()
#KT-18986 Fixed
2018-08-30 16:20:52 +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
Ilmir Usmanov 208c3a51ab Use short jvm names for the annotation parameters 2018-08-30 16:19:44 +03:00
Ilmir Usmanov c4287118d8 Add coroutines debug metadata: stdlib 2018-08-30 16:19:38 +03:00
Ilmir Usmanov fe451dce31 Implement correct is check for SuspendFunction
Add test for suspend functions with language version 1.2.
Minor edit in SuspendFunction docs.
2018-08-30 16:17:46 +03:00
Ilya Gorbunov f5df53b7a7 Detect UInt/ULong parsing overflow after digit addition instead of before
#KT-26161
2018-08-30 14:58:39 +03:00
Ilya Gorbunov d99f97ad96 Support '+' in front of parsed unsigned string values
#KT-26161
2018-08-30 14:58:37 +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 47162590eb Add a credit for Guava implementation of unsigned division and remainder 2018-08-30 14:58:30 +03:00
Ilya Gorbunov abdd971d92 More contentHashCode tests for arrays 2018-08-30 14:58:28 +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 6360cc3cb5 Unsigned arrays: expose storage field as internal PublishedApi
To be able to write basic extensions that access storage array.
2018-08-30 14:58:24 +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 76ff4c9b2f Remove custom hashCode and equals from unsigned types
The generated ones are ok now (on JVM)
2018-08-30 14:58:16 +03:00
Ilya Gorbunov f367322084 Introduce associateWith and associateWithTo functions
#KT-13814
2018-08-30 14:58:14 +03:00
Roman Elizarov 929064dfa7 Adjust SequenceBuilder to the new coroutines API
* Continuation.resumeWith(SuccessOrFailure)
* createCoroutineUnintercepted

(cherry picked from commit 8bbd78c)
2018-08-30 14:58:09 +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 47996dbf47 Temporary remove SequenceBuilder 2018-08-30 14:58:03 +03:00
Ilya Gorbunov e59141e32c Replace kotlin-stdlib-jreN usages in tests and samples 2018-08-30 14:57:56 +03:00
Ilya Gorbunov c8becbd335 Stop distributing and publishing obsolete artifacts
Keep stdlib-jreN dist for tests only.

#KT-23799
2018-08-30 14:57:52 +03:00
Ilmir Usmanov e93683621a Implement callSuspend and callSuspendBy functions as KCallable's
extension methods.
Also make isSuspend a member of KCallable.
 #KT-21972: Fixed
2018-08-30 14:57:48 +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 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