aboutsummaryrefslogtreecommitdiff
path: root/src/main
Commit message (Collapse)AuthorAgeFilesLines
...
* Handle while loops as expressions in ANF transform.Jason Zaugg2013-10-141-2/+6
| | | | | | | Append a `()`, as we do for `Unit` returning `if`-s and `try-s` We don't currently support `await` in try/catch, otherwise I'd write tests for that case, too.
* Merge pull request #30 from retronym/topic/unchecked-boundsJason Zaugg2013-08-235-12/+28
|\ | | | | Use @uncheckedBounds to avoid introducing refchecks errors …
| * Use @uncheckedBounds to avoid introducing refchecks errorsJason Zaugg2013-08-225-12/+28
| | | | | | | | | | | | | | | | | | ... in code that would otherwise have smuggled through these slack LUBs in the types of trees but never in a TypeTree. More details in SI-7694. Fixes #29
* | Collection of clean-upsPhilipp Haller2013-08-145-39/+30
|/ | | | | | - removed outdated comments in ANF transform - added a few comments - removed some unnecessary imports
* Don't set the body of If to the original type.Jason Zaugg2013-08-071-3/+3
| | | | Tweak the way we set tpe = Unit in matches.
* Remove unneeded special case in ANF transform.Jason Zaugg2013-08-071-2/+0
| | | | Obsolete now that we carry all the types around.
* Remove obsolete TODO comment.Jason Zaugg2013-08-071-2/+1
|
* Set the type of case bodies to Unit after ANF.Jason Zaugg2013-08-071-1/+1
| | | | Avoids runtime errors like: "java.lang.Double cannot be cast to scala.runtime.BoxedUnit"
* Disallow await in pattern guards (for now)Jason Zaugg2013-07-251-0/+3
|
* Preserve ApplyImplicitView / ApplyImplicitArgs in AnfTransform.Jason Zaugg2013-07-252-7/+16
|
* Support await in Typed nodes.Jason Zaugg2013-07-241-0/+4
|
* Support await in throws.Jason Zaugg2013-07-242-2/+8
| | | | | Also support AsyncId.async[Nothing], which was triggering a NPE in the generated `null.asInstanceOf[Nothing]`.
* Comply with range position checking.Jason Zaugg2013-07-115-14/+21
| | | | | | | | | - Make sure all trees are positioned - Mark range positions for synthetic code as transparent to allow some wiggle room for overlapping ranges. Enables -Yrangepos for our test suite. We can't add it for the entire build until the fix for SI-7649 lands in the compiler.
* Fix "BoxedUnit cannot be cast to String" error.Jason Zaugg2013-07-091-3/+3
| | | | | When convering If and Match nodes to ANF, set the type to Unit. Otherwise, erasure might end up casting BoxedUnit to a real type.
* Move implementation details to scala.async.internal._.Jason Zaugg2013-07-0716-99/+119
| | | | | If we intend to keep CPS fallback around for any length of time it should probably move there too.
* Fix another interation with existentials and a name clash.Jason Zaugg2013-07-072-6/+15
|
* An overdue overhaul of macro internals.Jason Zaugg2013-07-0313-888/+906
| | | | | | | | | | | | - Avoid reset + retypecheck, instead hang onto the original types/symbols - Eliminated duplication between AsyncDefinitionUseAnalyzer and ExprBuilder - Instead, decide what do lift *after* running ExprBuilder - Account for transitive references local classes/objects and lift them as needed. - Make the execution context an regular implicit parameter of the macro - Fixes interaction with existential skolems and singleton types Fixes #6, #13, #16, #17, #19, #21.
* call setSymbol only on outermost Apply for multi-arg-list applicationsLukas Rytz2013-04-291-1/+1
| | | | fixes a typo in 5a0b1918
* minor cleanups accumulated while reading the codeLukas Rytz2013-04-271-13/+14
|
* Mark `await` as @compileTimeOnlyJason Zaugg2013-04-171-2/+2
| | | | | | 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-172-46/+69
|\ | | | | 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-112-42/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-129-67/+195
| | | | | | | | | | | | - 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-101-0/+5
| | | | This time in the ANF/Inline transformation.
* Scala 2.10.1 compat: account for change in PartialFunction synthesis.Jason Zaugg2013-04-101-1/+9
| | | | | | | | | | | 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-101-0/+7
|
* Address deprecation warnings in Scala 2.10.1Jason Zaugg2013-04-103-8/+8
|
* 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-193-22/+70
|\ \ | |/ |/| Topic/patmat partial function
| * Prohibit lazy vals in async blocks.Jason Zaugg2012-12-101-3/+6
| |
| * Workaround non-idempotency of typing pattern matching anonymous functions.Jason Zaugg2012-12-103-19/+64
| | | | | | | | | | | | | | - 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-032-11/+32
|\ \ | | | | | | Fix ANF transform involving `xs: _*` trees.
| * | Fix ANF transform involving `xs: _*` trees.Jason Zaugg2012-11-272-11/+32
| | | | | | | | | | | | | | | | | | | | | | | | 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-272-4/+14
| | | | | | 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.
* Disallow await in non-primary param sections.Jason Zaugg2012-11-271-7/+22
| | | | | | | | | 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-271-8/+16
| | | | | | | | - 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-271-2/+2
| | | | | | And change TreeInterrogation to set if via this means, rather than through a direct means, which seems to assume too much about classloaders.
* Fix #42 - Futures created by async are not properly completed with exceptionsphaller2012-11-262-5/+26
| | | | | | | | | | | | 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> }
* 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-261-11/+11
| | | | | | 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-265-24/+58
| | | | | | | | | | | | 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-263-17/+82
| | | | | | 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-263-50/+60
| | | | | | | | 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-263-8/+40
| | | | | | | Any vals referred to in the body of these must also be lifted. Fixes #36