aboutsummaryrefslogtreecommitdiff
path: root/src/test
Commit message (Collapse)AuthorAgeFilesLines
* Remove CPS dependency from default async implementationPhilipp Haller2013-04-121-0/+49
| | | | | | - move all CPS-related code to `continuations` sub package - fix CPS-based async implementation - enable testing of CPS-based async implementation
* Scala 2.10.1 compat: apply renaming to originals of TypeTreesJason Zaugg2013-04-101-18/+17
| | | | This time in the ANF/Inline transformation.
* Scala 2.10.1 compat: account for change in PartialFunction synthesis.Jason Zaugg2013-04-101-21/+19
| | | | | | | | | | | 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-102-19/+20
|
* 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
|
* Remove unreachable code in pattern matching testphaller2012-12-201-1/+0
|
* Merge pull request #49 from phaller/topic/patmat-partial-functionJason Zaugg2012-12-193-11/+62
|\ | | | | Topic/patmat partial function
| * Prohibit lazy vals in async blocks.Jason Zaugg2012-12-101-0/+12
| |
| * Workaround non-idempotency of typing pattern matching anonymous functions.Jason Zaugg2012-12-103-11/+50
| | | | | | | | | | | | | | - 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
* | Fix ANF transform involving `xs: _*` trees.Jason Zaugg2012-11-271-0/+22
|/ | | | | | | | We need to unwrap and inline `xs`, then rewrap the result expression with the wildcard star. Addresses the first half of #46.
* No need to extract vals for inlinable args.Jason Zaugg2012-11-271-11/+9
| | | | | | 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-271-2/+30
| | | | | | | | | 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-0/+22
| | | | | | | | - 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.
* Lookup log level dynamically from system property.Jason Zaugg2012-11-271-17/+17
| | | | | | 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-262-15/+58
| | | | | | | | | | | | 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
| |
* | Make the name uniqification more selective.Jason Zaugg2012-11-261-1/+1
| | | | | | | | | | | | 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-263-63/+33
| | | | | | | | | | | | | | | | | | | | | | | | 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-23/+38
| | | | | | | | | | | | 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-262-2/+24
| | | | | | | | | | | | | | | | 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-262-3/+41
| | | | | | | | | | | | | | 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-264-32/+43
| | | | | | | | | | | | 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-262-28/+55
| | | | | | | | | | | | | | These gives us something to lift to vars to be accessed from multiple states of the state machine. Fixes #35
* | Address review commentphaller2012-11-261-3/+1
| |
* | Fix #19phaller2012-11-261-26/+66
|/ | | | | | | - Add tests where the result of an await is assigned to a variable external to the async block. - Clean up HygieneSpec.
* add missing copyrightJason Zaugg2012-11-2419-10/+46
|
* Prohibit await in if condition (for now)Jason Zaugg2012-11-243-14/+48
| | | | | | Test nested loops. Control ANF tracing with another system property.
* Prohibit return.Jason Zaugg2012-11-231-0/+12
| | | | Closes #21
* Explicitly prohibit await in nested methods.Jason Zaugg2012-11-232-2/+11
|
* Enable debug logging with a system property.Jason Zaugg2012-11-231-4/+5
|
* Support await in a while loop.Jason Zaugg2012-11-233-28/+60
|
* Test for await in while (currently forbidden).Jason Zaugg2012-11-232-0/+37
| | | | Lookup the ValDef symbol from Assign#rhs.symbol.
* Forbid await in try/catch.Jason Zaugg2012-11-231-0/+30
|
* Fix #31, Unfinished ANF transformJason Zaugg2012-11-232-1/+34
| | | | | | | | Prepend {(); ... } before starting the ANF transform. Add tracing to the anf/inline transform. Also enables and addresses SIP-18 warnings.
* Move TestUtils contents directly into the package object.Jason Zaugg2012-11-232-59/+42
| | | | Why suffer SI-4695 needlessly?
* Ensure unique names for definitions in the async block.Jason Zaugg2012-11-232-32/+33
| | | | | | | | - transform the provided tree using reflect.internal.Symbols#Symbol.name_= and treeCopy.{Ident, Select}. - not sure if this is possible within the public Symbol API. - move checking for unsupported nested module/class to AsyncAnalysis. - make block merging selective (only do so if there are nested await calls.)
* Support match as an expression.Jason Zaugg2012-11-224-28/+54
| | | | | | | | - corrects detection of await calls in the ANF transform. - Split AsyncAnalyzer into two parts. Unsupported await detection must happen prior to the async transform to prevent the ANF lifting out by-name arguments to vals and hence changing the semantics.
* Cleanups and docs.Jason Zaugg2012-11-222-59/+32
| | | | | - Move now-working duplicate definition tests from `neg` to `run`. - Renames and small code beautification around the var lifting analysis
* Minimize lifting of vars.Jason Zaugg2012-11-221-2/+1
|
* Preserve ValDef symbol.Jason Zaugg2012-11-211-1/+3
|
* Only transform if/match-s that contain an await.Jason Zaugg2012-11-213-4/+76
| | | | | | Accurate reporting of misplaced awaits. Attempt to collect the minimal set of vars to lift.
* Add negative tests for inlining blocks in ANF transformphaller2012-11-201-0/+57
|
* Generate cleaner code for Unit-typed if-else expressionsphaller2012-11-161-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of generating an assignment to a Unit-typed variable, just add the Unit value after the if-else expression: [async] scala.async.Async.async[Unit]({ val f: scala.concurrent.Future[Int] = AnfTestClass.this.base(y); if (y.>(0)) State.result_=(scala.async.Async.await[Int](f).+(2)) else State.result_=(scala.async.Async.await[Int](f).-(2)) }) [async] ANF transform expands to: { val f: scala.concurrent.Future[Int] = AnfTestClass.this.base(y); if (y.>(0)) { val await$8: Int = scala.async.Async.await[Int](f); State.result_=(await$8.+(2)) } else { val await$9: Int = scala.async.Async.await[Int](f); State.result_=(await$9.-(2)) }; () }
* Add selective ANF transformphaller2012-11-161-0/+94
| | | | | - Does not descend into class and module defs - Adds several tests, including tests for if-else