aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright years.Jason Zaugg2014-01-1432-33/+33
| | | | 2013 must have been unlucky.
* Minor fixes in Async`s scaladoc.akomar2014-01-121-2/+2
|
* Merge pull request #47 from retronym/topic/pres2Jason Zaugg2013-11-221-6/+5
|\ | | | | Another take at the 2.10/2.11 spanning suppressMacroAttachment
| * Another take at the 2.10/2.11 spanning suppressMacroAttachmentJason Zaugg2013-11-201-6/+5
| | | | | | | | It was only working on the former.
* | Fix crashers in do/while and while(await(..))Jason Zaugg2013-11-225-34/+73
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | The new tree shapes handled for do/while look like: // type checked async({ val b = false; doWhile$1(){ await(()); if (b) doWhile$1() else () }; () }) We had to change ExprBuilder to create states for the if/else that concludes the doWhile body, and also loosen the assertion that the label jump must be the last thing we see. We also have to look for more than just `containsAwait` when deciding whether an `If` needs to be transformed into states; it might also contain a jump to the enclosing label that is on the other side of an `await`, and hence needs to be a state transition instead.
* Merge pull request #42 from retronym/topic/hooksJason Zaugg2013-11-204-12/+58
|\ | | | | Hooks for custom async implementations
| * Abstract over use of scala.util.TryJason Zaugg2013-11-134-11/+52
| | | | | | | | | | Custom implementation of the async macro may choose to use a different data type to represent `Throwable | A`.
| * Add a hook for post-ANF transformationJason Zaugg2013-11-132-1/+6
| | | | | | | | For use by custom implementations of the async macro.
* | Less hacky check for presentation compiler.Jason Zaugg2013-11-201-1/+1
| | | | | | | | "There's a method for that!"
* | Return original macro application under presentation compiler.Jason Zaugg2013-11-202-7/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now, the body of an async block suffers from diminished IDE support: most notably hyperlinking doesn't work [1]. During the course of the blackbox/whitebox macro discussion, we've often talked about how the former give us the latitude to simply disable macro expansion in the IDE so we could get these features working again, at the cost of losing domain specific errors, such as "await must not be used under a nested function". But why not have our cake and eat too? This commit detects if we are running the presentation compiler and, after running our regular macro, returns the original macro application. We need to annotate that tree to prevent the typechecker from stubbornly calling our macro again. EXPERIMENTAL NOTE: This logic shouldn't live in macros: this is just a short term measure. If these experiments in async prove successful, we'll roll something similar into the macro expansion engine itself. TODO: as a performance optimization, we could just run the "unsupported await" checks, and avoid doing the more expensive state machine transformation. [1] https://www.assembla.com/spaces/scala-ide/tickets/1001449-code-navigation-fails-when-macros-are-used#/activity/ticket:
* | Fix a NPE in the presentation compilerJason Zaugg2013-11-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were using a TypingTransformer and we called `atOwner` before we had called `transform`. This meant that `currTree` was null, which was observed when that was passed to `Context#make`. IDE ticket: https://scala-ide-portfolio.assembla.com/spaces/scala-ide/tickets/1001971#/activity/ticket: Stack trace: exception during macro expansion: java.lang.NullPointerException at scala.tools.nsc.interactive.ContextTrees$class.addContext(ContextTrees.scala:78) at scala.tools.nsc.interactive.Global.addContext(Global.scala:28) at scala.tools.nsc.interactive.Global.registerContext(Global.scala:268) at scala.tools.nsc.typechecker.Contexts$Context.make(Contexts.scala:295) at scala.tools.nsc.typechecker.Contexts$Context.make0(Contexts.scala:320) at scala.tools.nsc.typechecker.Contexts$Context.make(Contexts.scala:327) at scala.tools.nsc.typechecker.Typers$Typer.atOwner(Typers.scala:5662) at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:33) at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:28) at scala.async.internal.AsyncTransform$class.fixup$1(AsyncTransform.scala:191)
* | Clean-ups found during review of PR #43Philipp Haller2013-11-141-10/+2
| |
* | Fix crasher in icode due to symbol mismatches in lifted methodsJason Zaugg2013-11-142-37/+94
|/ | | | | | | | | These stem from the handling of the internal/external view or method type parameters by `thisMethodType` in `Namers`. I've now preseversed the orginal ValDefs favoured the latter when constructing the new DefDef, and made construction of all liftables consistent in this regard.
* Don't aggressively null out captured varsJason Zaugg2013-11-125-18/+205
| | | | | Once they escape, we leave the references in the state machines fields untouched.
* Remove left-overs of CPS fallback logicPhilipp Haller2013-11-072-5/+3
| | | | Completes removal performed in #37.
* Remove scala.async.StateMachineJason Zaugg2013-11-072-19/+8
| | | | | | The generated code can simply extends Function1 and Function0. This class was a hacky means to get the macro working a long time ago.
* Minimize the public APIJason Zaugg2013-11-0715-279/+73
| | | | | | | | | | - Remove the CPS fallback version of async. That was not intended to be part of 1.0. - Lookup the await method beside the macro, rather than requiring all calls to go to AsyncBase.await. - Create a minimal version of Async that just contains await/async and delegates to the macro implementation in internal._ - Add scaladoc.
* Scala 2.11 compatibilityJason Zaugg2013-11-072-1/+17
| | | | | | We were relying on an internal API that no longer exists. We also need to tweak the way our tests infer scalaBinaryVersion.
* Add more doc commentsPhilipp Haller2013-10-221-1/+8
|
* Avoid zero-ing out dead fields of primitive value class typePhilipp Haller2013-10-223-14/+126
| | | | | - Zero out fields of type Any - Zero out fields of value class type
* Enables testing the resetting of lifted local variablesPhilipp Haller2013-10-226-8/+81
| | | | | | | - Adds a hook that lets a derived macro insert additional code when zero-ing out a lifted field. - Adds a variant of the `AsyncId` macro that logs zeroed-out fields. - Adds a test using this mechanism
* Fix looping issue when computing last usages of fieldsPhilipp Haller2013-10-222-23/+20
| | | | | - A missing condition could cause an infinite loop - Various clean-ups
* Liveness analysis to avoid memory retention issuesPhilipp Haller2013-10-224-18/+248
| | | | | | | | - Iterative, backwards data-flow analysis - Make sure fields captured by nested defs are never zeroed out. This is done elegantly by declaring such fields a being live at the exit of the final state; thus, they will never be zeroed out.
* More complete doc commentsPhilipp Haller2013-10-181-19/+33
|
* Simplify a generated CaseDef tree in resume methodPhilipp Haller2013-10-181-3/+2
| | | | | | | | | | | | | | | | | | | OLD: case (throwable @ _) if NonFatal.apply(throwable) => { { stateMachine$1.this.result.complete(Failure.apply[Nothing](throwable)); () }; () } NEW: case (throwable @ _) if NonFatal.apply(throwable) => { stateMachine$1.this.result.complete(Failure.apply[Nothing](throwable)); () }
* Minor clean-upsPhilipp Haller2013-10-182-9/+11
|
* Handle while loops as expressions in ANF transform.Jason Zaugg2013-10-142-2/+20
| | | | | | | 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-2327-76/+93
|\ | | | | Use @uncheckedBounds to avoid introducing refchecks errors …
| * Use @uncheckedBounds to avoid introducing refchecks errorsJason Zaugg2013-08-227-13/+93
| | | | | | | | | | | | | | | | | | ... 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
| * Remove @RunWith annotations from test cases.Jason Zaugg2013-08-1521-63/+0
| | | | | | | | | | These are are at odds with the junit-interface SBT test framework under SBT 0.13.+, and appear to be superfluous.
* | Collection of clean-upsPhilipp Haller2013-08-146-40/+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-072-1/+15
| | | | Avoids runtime errors like: "java.lang.Double cannot be cast to scala.runtime.BoxedUnit"
* Disallow await in pattern guards (for now)Jason Zaugg2013-07-252-0/+13
|
* Preserve ApplyImplicitView / ApplyImplicitArgs in AnfTransform.Jason Zaugg2013-07-254-13/+37
|
* 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-242-0/+12
|
* Support await in throws.Jason Zaugg2013-07-243-2/+18
| | | | | 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-092-3/+24
| | | | | 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-0727-140/+166
| | | | | 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-075-8/+61
|
* An overdue overhaul of macro internals.Jason Zaugg2013-07-0318-998/+1021
| | | | | | | | | | | | - 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.
* Avoid hardcoded "2.10" in tests.Jason Zaugg2013-07-022-4/+19
| | | | This allows us to cross build against 2.10.x and 2.11.x.
* 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-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