aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Enable generalized state machinestopic/wip-futuresystem-extensionPhilipp Haller2013-05-235-13/+199
| | | | | | | - async { } block can now generate a subclass of an existing trait - future system can directly return the state machine instance from async, without spawning an actual future - adds iterator-based async implementation with future system
* Abstract over type of generated state machinePhilipp Haller2013-04-263-6/+6
| | | | Removes method `TransformUtils.applied`.
* Abstract from Try in onComplete of FutureSystem#OpsPhilipp Haller2013-04-263-5/+11
| | | | | Adds `Result[A]` type member to `FutureSystem` and `def resultType[A]` to `FutureSystem#Ops`.
* Refactor TryBasedFutureSystemPhilipp Haller2013-04-261-32/+19
|
* Abstract from Try's get and isFailure methodsPhilipp Haller2013-04-263-31/+51
| | | | | | | | | Adds the following methods to `FutureSystem#Ops`: def isFailedResult(name: TermName): Expr[Boolean] def resultValue(name: TermName, resultType: Type): Tree Introduces `TryBasedFutureSystem` trait.
* Split FutureSystem's completeProm extension point into 3 partsPhilipp Haller2013-04-262-12/+43
| | | | | | | | | | | | | This replaces the single, `Try`-dependent `completeProm` method with: def completeProm[A: WeakTypeTag]( prom: Expr[Prom[A]], value: Expr[A]): Expr[Unit] def completePromWithExceptionTopLevel[A: WeakTypeTag]( prom: Expr[Prom[A]], exception: Expr[Throwable]): Expr[Unit] def completePromWithFailedResult[A: WeakTypeTag]( prom: Expr[Prom[A]], resultName: TermName): Expr[Unit]
* Mark `await` as @compileTimeOnlyJason Zaugg2013-04-172-3/+3
| | | | | | Rather than as @deprecated. This commit means we can no longer build against 2.10.0.
* Merge pull request #9 from retronym/ticket/4-multi-paramPhilipp Haller2013-04-174-74/+134
|\ | | | | Allow await in applications with multiple argument lists
| * Rephrase a few pattern matches, fix ANF tracing.Jason Zaugg2013-04-152-11/+9
| | | | | | | | Addresses review comments
| * Allow await in applications with multiple argument listsJason Zaugg2013-04-114-70/+132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, we levied an implementation restriction to prevent this. As it turned out, that needlessly prevented use of `await` in the receiver of a multi-param-list application. This commit lifts the restriction altogether, and treats such applications holistically, being careful to preserve the left-to-right evaluation order of arguments in the translated code. - use `TreeInfo.Applied` and `Type#paramss` from `reflect.internal` to get the info we need - use the parameter name for the lifted argument val, rather than `argN` - encapsulate handling of by-name-ness and parameter names in `mapArgumentss` - test for evaluation order preservation
* | Remove CPS dependency from default async implementationPhilipp Haller2013-04-1210-67/+244
| | | | | | | | | | | | - move all CPS-related code to `continuations` sub package - fix CPS-based async implementation - enable testing of CPS-based async implementation
* | Avoid needless Unit literal as the expression of a Block.Jason Zaugg2013-04-111-1/+1
|/ | | | We've got a perfectly good expression at hand.
* Scala 2.10.1 compat: apply renaming to originals of TypeTreesJason Zaugg2013-04-102-18/+22
| | | | This time in the ANF/Inline transformation.
* Scala 2.10.1 compat: account for change in PartialFunction synthesis.Jason Zaugg2013-04-102-22/+28
| | | | | | | | | | | Since SI-6187, the default case of a partial function is now included in the tree. Before, it was a tree attachment, conditionally inserted in the pattern matcher. I had hoped that that change would allow us to do away with `RestorePatternMatchingFunctions` altogether, but it seems that we aren't so lucky. Instead, I've adapted that transformer to account for the new scheme.
* Scala 2.10.1 compat: apply renaming to originals of TypeTreesJason Zaugg2013-04-103-19/+27
|
* Temporarily comment out tests that are failing under 2.10.1.Jason Zaugg2013-04-104-61/+66
|
* Address lint warnings.Jason Zaugg2013-04-101-2/+2
|
* Address deprecation warnings in Scala 2.10.1Jason Zaugg2013-04-103-8/+8
|
* Remove unreachable code in pattern matching testphaller2012-12-201-1/+0
|
* Resolve merge conflictphaller2012-12-195-17/+93
|\
| * New fix for #1861: Add fall-back to CPS for all unsupported uses of awaitphaller2012-12-195-16/+93
| | | | | | | | | | | | | | This is a re-implementation of a previous fix. It is more modular, since it enables the definition of a CPS-based fall-back as a subclass of `AsyncBase`. Thus, it's possible to define fall-back-enabled subclasses of `AsyncBase` targetting not only Scala Futures.
* | Merge pull request #49 from phaller/topic/patmat-partial-functionJason Zaugg2012-12-196-33/+132
|\ \ | |/ |/| Topic/patmat partial function
| * Prohibit lazy vals in async blocks.Jason Zaugg2012-12-102-3/+18
| |
| * Workaround non-idempotency of typing pattern matching anonymous functions.Jason Zaugg2012-12-106-30/+114
| | | | | | | | | | | | | | - Undo the transformation that takes place in Typers to leave us with Match(EmptyTree, cases). - Make sure we don't descend into the cases of such a tree when peforming the async transform
* | Merge pull request #47 from phaller/ticket/46-varargs-holistic-applyPhilipp Haller2012-12-033-11/+54
|\ \ | | | | | | Fix ANF transform involving `xs: _*` trees.
| * | Fix ANF transform involving `xs: _*` trees.Jason Zaugg2012-11-273-11/+54
| | | | | | | | | | | | | | | | | | | | | | | | We need to unwrap and inline `xs`, then rewrap the result expression with the wildcard star. Addresses the first half of #46.
* | | Fix typophaller2012-11-291-3/+3
|/ /
* / Remove @author tagsphaller2012-11-273-9/+0
|/
* No need to extract vals for inlinable args.Jason Zaugg2012-11-273-15/+23
| | | | | | We use `isExprSafeToInline` from the non-public reflection API to check. In addtion, we now that an untyped Ident("await$N") is also an inlinable expression.
* Test cases for named and default args.Jason Zaugg2012-11-271-1/+35
|
* Disallow await in non-primary param sections.Jason Zaugg2012-11-272-9/+52
| | | | | | | | | We can allow it, but we need to treat nested Apply trees holistically, in order to lift out all the arguments and maintain the correct evaluation order. Fixes #33.
* Fix semantics of by-name applicationJason Zaugg2012-11-272-8/+38
| | | | | | | | - If we lift one arg, we must lift them all. This preserves evaluation order. - But, never lift an by-name arg Addresses the first half of #33.
* Fix execution context lookup for the trivial async block.Jason Zaugg2012-11-271-1/+1
|
* Lookup log level dynamically from system property.Jason Zaugg2012-11-272-19/+19
| | | | | | And change TreeInterrogation to set if via this means, rather than through a direct means, which seems to assume too much about classloaders.
* More tests for ExceptionsSpecphaller2012-11-261-8/+30
|
* Fix #42 - Futures created by async are not properly completed with exceptionsphaller2012-11-264-20/+84
| | | | | | | | | | | | This augments the on-complete handler for an async state with await as follows: if (tr.isFailure) result$async.complete(tr.asInstanceOf[Try[T]]) else { <resultName> = tr.get.asInstanceOf[<resultType>] <nextState> <mkResumeApply> }
* Merge pull request #37 from phaller/ticket/23-port-futures-testsPhilipp Haller2012-11-261-0/+536
|\ | | | | Port futures tests of scala.concurrent
| * Replace uses of Future.map/Future.flatMap with async+awaitphaller2012-11-261-24/+33
| |
| * Add ported futures testsphaller2012-11-261-0/+527
| | | | | | | | | | | | These tests do not use async/await, yet. Refs #23
* | Show that indirectly nested defs aren't lifted.Jason Zaugg2012-11-262-3/+18
| |
* | Fix #26, leaner code gen for `async { <no awaits> }`.Jason Zaugg2012-11-261-9/+20
| | | | | | | | We can then use this as a replacement for `Future { expr }`.
* | Make the name uniqification more selective.Jason Zaugg2012-11-262-12/+12
| | | | | | | | | | | | We need not, and should not, rename definitions beyond the scope of the async transform, e.g. in nested classes of function bodies.
* | Rewrite the state machine to a class, rather than an object.Jason Zaugg2012-11-268-87/+91
| | | | | | | | | | | | | | | | | | | | | | | | To avoid suprises in tree retyping, the instance of this class is immediately upcase to StateMachine[Promise[T], ExecContext]. Allow nested non-case classes. These pop up when we use nested async calls. Only look for duplicate names in the subtrees traversed by AsyncTraverser.
* | Preserve outer This() refs through resetAttrs.Jason Zaugg2012-11-266-40/+120
| | | | | | | | | | | | Adapt the compiler's standard ResetAttrs to keep This() nodes don't refer to a symbol defined in the current async block.
* | Synthesize an object implementing Function#apply and resume()Jason Zaugg2012-11-265-52/+84
| | | | | | | | | | | | | | | | There is a fly in the ointment: any This() trees in the provided code are getting rebound to this class. Sounds like more resetAttrs fun ahead. The object also serves as the Future {} thunk.
* | Lift local defs and functions.Jason Zaugg2012-11-265-11/+81
| | | | | | | | | | | | | | Any vals referred to in the body of these must also be lifted. Fixes #36
* | Fix await in if condition / match scrutinee.Jason Zaugg2012-11-267-41/+59
| | | | | | | | | | | | The type-checking performed in ANF transform is precarious, and needed to use the original condition/ scrutinee in a throwaway tree to get things to work.
* | Extract vals for all names bound in a pattern.Jason Zaugg2012-11-266-49/+106
| | | | | | | | | | | | | | These gives us something to lift to vars to be accessed from multiple states of the state machine. Fixes #35
* | Flatmap it, Sam.Jason Zaugg2012-11-261-4/+1
| |
* | Merge pull request #38 from phaller/ticket/19-external-varsPhilipp Haller2012-11-261-26/+64
|\ \ | | | | | | Fix #19