aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/scala/async/run/anf/AnfTransformSpec.scala
Commit message (Collapse)AuthorAgeFilesLines
* Reduce logging overhead and minor cleanupsRory Graves2017-06-211-3/+3
|
* Avoid masking user exception with ??? for Nothing typed expressionsJason Zaugg2015-07-271-0/+42
| | | | | | | | | | | | | | | | | | | | | | Code like: val x = if (cond) throw new A else throw new B Was being transformed to: val ifRes = ??? if (cond) ifRes = throw new A else ifRes = throw new B val x = ifRes by way of the use of `gen.mkZero` which throws `???` if the requested type is `Nothing` This commit special cases `Nothing` typed expressions in a similar manner to `Unit` type expressions. The example above is now translated to: if (cond) throw new A else throw new B val x = throw new IllegalStateException() Fixes #120
* currentUnit.freshName => c.freshName (leads to less precise tests...)Eugene Burmako2014-02-151-1/+1
|
* Update copyright years.Jason Zaugg2014-01-141-1/+1
| | | | 2013 must have been unlucky.
* Remove @RunWith annotations from test cases.Jason Zaugg2013-08-151-3/+0
| | | | | These are are at odds with the junit-interface SBT test framework under SBT 0.13.+, and appear to be superfluous.
* Set the type of case bodies to Unit after ANF.Jason Zaugg2013-08-071-0/+14
| | | | Avoids runtime errors like: "java.lang.Double cannot be cast to scala.runtime.BoxedUnit"
* Preserve ApplyImplicitView / ApplyImplicitArgs in AnfTransform.Jason Zaugg2013-07-251-0/+17
|
* Test case for await in an Assign node.Jason Zaugg2013-07-241-0/+11
| | | | This case already works.
* Support await in Typed nodes.Jason Zaugg2013-07-241-0/+8
|
* Support await in throws.Jason Zaugg2013-07-241-0/+10
| | | | | Also support AsyncId.async[Nothing], which was triggering a NPE in the generated `null.asInstanceOf[Nothing]`.
* Move implementation details to scala.async.internal._.Jason Zaugg2013-07-071-19/+16
| | | | | If we intend to keep CPS fallback around for any length of time it should probably move there too.
* An overdue overhaul of macro internals.Jason Zaugg2013-07-031-1/+1
| | | | | | | | | | | | - 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.
* Allow await in applications with multiple argument listsJason Zaugg2013-04-111-18/+58
| | | | | | | | | | | | | | | | | | | 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
* Scala 2.10.1 compat: apply renaming to originals of TypeTreesJason Zaugg2013-04-101-18/+17
| | | | This time in the ANF/Inline transformation.
* Temporarily comment out tests that are failing under 2.10.1.Jason Zaugg2013-04-101-17/+18
|
* 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.
* 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.
* Preserve outer This() refs through resetAttrs.Jason Zaugg2012-11-261-2/+2
| | | | | | Adapt the compiler's standard ResetAttrs to keep This() nodes don't refer to a symbol defined in the current async block.
* add missing copyrightJason Zaugg2012-11-241-1/+1
|
* Fix #31, Unfinished ANF transformJason Zaugg2012-11-231-0/+33
| | | | | | | | Prepend {(); ... } before starting the ANF transform. Add tracing to the anf/inline transform. Also enables and addresses SIP-18 warnings.
* Ensure unique names for definitions in the async block.Jason Zaugg2012-11-231-31/+32
| | | | | | | | - 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-221-23/+51
| | | | | | | | - 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-221-0/+32
| | | | | - Move now-working duplicate definition tests from `neg` to `run`. - Renames and small code beautification around the var lifting analysis
* 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