Commit Graph

61 Commits

Author SHA1 Message Date
Ilya Gorbunov 6bfb5c59a3 Make ResultTest common
Use custom exception type to avoid platform differences in toString implementation.
2018-09-14 15:32:25 +03:00
Ilya Gorbunov bf4be12239 Stdlib: review and suppress warnings 2018-09-14 15:32:25 +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
Anton Bannykh ead9b31e03 JS: support [suspend] fun main([args: Array<String>]) (KT-26628, KT-26572 fixed) 2018-09-12 09:49:25 +03:00
Roman Artemev cc995bf1d5 Remove workaround for COROUTINE_SUSPENDED property 2018-09-11 14:29:47 +03:00
Roman Elizarov b12e0aab2f Remove contract from Result.xxxCatching functions
Fixes KT-26523
2018-09-09 11:36:47 +03:00
Roman Elizarov 2406bf0536 Restore SuccessOrFailure.kt to bootstrap (to be removed later) 2018-09-09 11:34:49 +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 700e6fc5e3 Extract carrier value from continuation result
Otherwise incorrect type gets into continuation: SuccessOrFailure<T> instead of T.
2018-09-07 01:28:32 +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 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
Mikhail Zarechenskiy bc7f13b838 Temporarily allow equals & hashCode for SoF to compile bootstrap
equals & hashCode should be removed completely soon anyway
2018-09-06 10:39:34 +03:00
Ilmir Usmanov 53a1526412 Add version to DebugMetadata
#KT-26580 Fixed
2018-09-05 22:51:55 +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
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
Roman Elizarov a9eb94d822 Introduce CoroutineStackFrame interface for coroutine stack reconstruction in debugger
Fixes KT-26339
2018-08-30 16:21:46 +03:00
Ilmir Usmanov e8597d706d Implement debug-friendly Continuation.toString()
#KT-18986 Fixed
2018-08-30 16:20:52 +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
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 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
Alexander Udalov 51979b9ffa Convert FunctionBase to Kotlin, add type parameter to Lambda
This will make it possible to avoid raw types when inheriting from both
FunctionBase and Function<R>. This change adds a generic type parameter
to FunctionBase and Lambda which is not source-breaking under our policy
because both FunctionBase and Lambda are internal classes (located in
package kotlin.jvm.internal)
2018-08-30 14:52:33 +03:00
Ilmir Usmanov 4a7703ed66 Implement correct is check for SuspendFunction
Let callable references implement SuspendFunction
Do not generate CHECKCAST SuspendFunction when LV is 1.2

 #KT-25825: Fixed
2018-08-22 16:21:27 +03:00
Roman Elizarov 4fe2730f4a SuccessOrFailure.getOrDefault 2018-08-21 17:07:20 +03:00
Denis Zharkov d35e73d29b Get rid of COROUTINE_SUSPENDED replacement in SuspendFunction wrappers 2018-08-21 13:46:01 +03:00
Denis Zharkov ca39cc47c9 Support calling experimental coroutines API in JVM
The support is very limited, though

 #KT-25683 Fixed
2018-08-21 13:46:01 +03:00
Denis Zharkov 20c7a97bcd Make experimental/release COROUTINE_SUSPENDED reference the same instance
It's necessary when mixing experimental/release coroutines together

 #KT-25683 In Progress
2018-08-21 13:44:02 +03:00
Denis Zharkov db34555800 Use package property COROUTINE_SUSPENDED instead of enum entry
For sake of encapsulation: actual property content might be
different from the entry
2018-08-21 13:44:02 +03:00
Roman Elizarov 819ffe7117 Remove suspending function migration adapters for 1.3-M1 2018-07-20 16:57:42 +03:00
Roman Elizarov f5193802fc Uncommented coroutines tests that were failing due to inline class bugs 2018-07-19 10:32:55 +03:00
Roman Elizarov 20c255948a Coroutines migration adapters 2018-07-18 12:29:17 +03:00
Ilmir Usmanov 991b4251f3 Remove redundant RequireKotlin annotations from coroutines' stdlib. 2018-07-17 17:31:03 +03:00
Roman Elizarov 2236049341 Wrapper for suspend fun main and @Test suspend fun testXXX functions. 2018-07-17 12:15:02 +03:00
Roman Elizarov d33d21907d SuccessOrFailure test on JVM added 2018-07-17 12:15:01 +03:00
Roman Elizarov 0b59061bfe Coroutines debug probes 2018-07-17 12:15:01 +03:00
Roman Elizarov 78192ea712 Fixed createCoroutineFromSuspendFunction
Passes an object that extends BaseContinuationImpl to the
suspend function invocation, so that it can use .intercepted on it.
This requires implementation to track its state via label variable.
2018-07-17 12:14:59 +03:00
Roman Elizarov d3982472a4 Explanatory comment to createCoroutineFromSuspendFunction 2018-07-17 11:28:48 +03:00
Roman Elizarov 96b5bb1b31 Fixed JVM Serialization problems:
* EmptyCoroutineContext readResolve fixed
* CombinedContext.writeReplace serializes all context elements
2018-07-17 11:28:38 +03:00
Roman Elizarov e0f6165f10 Updated SuccessOrFailure:
* Parameter names for lambda
* getOrElse takes exception parameters
* fold added
* Improved docs
2018-07-17 11:26:49 +03:00
Anton Bannykh 99ac43eb84 JS: implement release coroutines in stdlib 2018-07-12 14:18:34 +03:00
Ilmir Usmanov 6ba2baa9da Deserialize constructors and properties with version requirement 1.3
if they have suspend function type in their descriptors.
Also, review fixes.

 #KT-25256: Fixed
2018-07-11 14:20:46 +03:00
Ilmir Usmanov 5b7e099842 Read old suspend functions in 1.3 2018-07-11 14:20:41 +03:00
Roman Elizarov 3aa76c58fc Updated SuccessOrFailure class corresponding to KEEP-127 and docs. 2018-07-09 15:27:19 +03:00
Roman Elizarov 33f4a3fcbf Extracted BaseContinuationImpl 2018-07-09 15:27:19 +03:00
Roman Elizarov 38c17249b9 releaseInterceptedContinuation clarified and ref check in impl fixed 2018-07-09 15:27:19 +03:00
Roman Elizarov d33409ff8a Fixed boxing of SuccessOrFailure inside SafeContinuation impl 2018-07-09 15:27:19 +03:00
Roman Elizarov 0370fac0b6 Further design improvements for coroutines 1.3 APIs
* Documentation improvements and clarification
* Dropped legacy intrinsic functions
* Remove context parameter default from Continuation builder function
2018-07-09 15:27:19 +03:00