aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #133 from retronym/backport/1502.10.xJason Zaugg2015-07-306-24/+109
|\ | | | | Backport fix for #150 to 2.10.x
| * [backport] Make nsc.Global based tests work under SBTJason Zaugg2015-07-301-17/+3
| | | | | | | | | | | | And remove unused code. (cherry picked from commit 7238bc1982cb1d87157c650115a2ae92a58430c9)
| * [backport] Stop test compiler before code generationJason Zaugg2015-07-301-3/+3
| | | | | | | | | | | | | | This avoids leaving .class files in the working directory after running the test. (cherry picked from commit 5bb93b0b7357259eb588437a45063bf43595028a)
| * [backport] Avoid dead code warning with async(throw T)Jason Zaugg2015-07-303-2/+21
| | | | | | | | | | | | | | | | By declararing the parameter of `async` as by-name. Fixes #150 (the bug in the original ticket.) (cherry picked from commit 4b1dbeef9ec73612867afc5dd9c925faa8cbc30d)
| * [backport] Avoid dead code warnings in generated code.Jason Zaugg2015-07-303-4/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we blindly splicing `{..$stats, ..$generatedCode}`, and the last expression in `$stats` is of type `Nothing`, we'll incur a dead code warning when typechecking the block. This commit: - introduces a helper method to augment user-written stats with synthetic code - Emit a try/finally in that code (so we advance the state, even if we are about to exit the state machine in the async-block global exception handler - Hide `Nothing` typed expressions from the dead code analysis by wrapping them in an `expr: Any` Fixes #150 (the part reported in the comments, not the original ticket.)
| * [backport] Cleanup code generation by avoiding redundant blocksJason Zaugg2015-07-302-19/+45
| | | | | | | | | | | | | | | | | | Don't bother adding `{ ...; () }` if we can use the original tree(s) instead, e.g. if the last tree in `...` conforms to `Unit`. This makes the debug output of the macro a little easier to read. (cherry picked from commit de641dc265f34b06e17dfa7c64be00219f72b670)
* | Merge pull request #129 from scala/bump/0.9.6-2.10Jason Zaugg2015-07-301-1/+1
|\ \ | | | | | | bump/0.9.6-2.10
| * | bump/0.9.6-2.10bump/0.9.6-2.10Jason Zaugg2015-07-281-1/+1
|/ / | | | | Bump to 0.9.6-SNAPSHOT
* | Merge pull request #127 from retronym/backport/20150727v0.9.5_2.10Jason Zaugg2015-07-273-3/+53
|\ \ | |/ |/| Backports for two recently fixed bugs.
| * Avoid masking user exception with ??? for Nothing typed expressionsJason Zaugg2015-07-273-2/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 (cherry picked from commit 80aaf18d5111322baee73dad30eb0a81cdd62314)
| * Avoid leaking untyped trees out of macroJason Zaugg2015-07-271-1/+1
|/ | | | | | | | | | | | The stack trace and bisection in #119 made me notice that we are failing to typecheck the cast we generated in the fix for #74. The ticket doesn't have a reproduction, so I'm submitting this without a test case. Fixes #119 (cherry picked from commit a037da192dbea32cffa8c5c8d33e7c56af0c353f)
* Merge pull request #124 from retronym/backport/sbt-bumpJason Zaugg2015-07-271-1/+1
|\ | | | | Update SBT for the warn command, now assumed by sbt-extras
| * Update SBT for the warn command, now assumed by sbt-extrasJason Zaugg2015-07-271-1/+1
| | | | | | | | (cherry picked from commit f6a5c93acb7628c4d169b778e386332c6d1bd99b)
* | Merge pull request #125 from retronym/topic/travis-bumpJason Zaugg2015-07-271-1/+1
|\ \ | |/ |/| Opt in to container based TravisCI
| * Opt in to container based TravisCIJason Zaugg2015-07-271-1/+1
|/
* Merge pull request #118 from scala/bump/0.9.5-SNAPSHOT_2.10Jason Zaugg2015-07-071-1/+1
|\ | | | | Bump version to v0.9.5-SNAPSHOT
| * Bump version to v0.9.5-SNAPSHOTbump/0.9.5-SNAPSHOT_2.10Jason Zaugg2015-07-071-1/+1
|/
* Merge pull request #115 from retronym/backport/74v0.9.4_2.10Jason Zaugg2015-07-072-1/+46
|\ | | | | Avoid compiler warning when awaiting Future[Unit]
| * Avoid compiler warning when awaiting Future[Unit]Jason Zaugg2015-07-072-1/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the ANF transform, we were generating a tree of the shape: { val temp: Unit = await(futureOfUnit) temp () } I tried to simplifiy this to avoid creating the temporary value, but this proved difficult as it would have required changes to the subsequent state machine transformation. Even replacing `temp` with `()` made the state machine transform harder. So for now, I've just inserted `temp.asInstanceOf[Unit]` to hide from the compiler warning. Fixes #74 (cherry picked from commit f3f058991b207a07041672a7e119422d9054788d)
* | Merge pull request #113 from retronym/backport/104Jason Zaugg2015-07-062-1/+27
|\ \ | | | | | | [backport] Avoid masking real errors with NotImplemented awaiting Future[Nothing]
| * | [backport] Avoid masking real errors with NotImplemented awaiting ↵Jason Zaugg2015-07-062-1/+27
|/ / | | | | | | | | | | | | | | | | | | Future[Nothing] This commit disabled live variable analysis for intermediate values of type Nothing. Fixes #104 (cherry picked from commit 6353443a0adec384172c38efac3bc96b9d2cbad2)
* | Merge pull request #108 from retronym/ticket/106-2.10.xJason Zaugg2015-07-062-2/+16
|\ \ | | | | | | Fix compiler crash with value class in result position
| * | Fix compiler crash with value class in result positionJason Zaugg2015-07-062-2/+16
| |/ | | | | | | | | | | | | | | | | We were leaking untyped trees out of the macro, which crashed in refchecks. This commit proactively typechecks the tree returned by `mkZero`. (cherry picked from commit f4275e22e000541eb619808723b70bd64b9b4873)
* / Update README.mdJason Zaugg2015-07-061-12/+2
|/
* Merge pull request #103 from retronym/topic/0.9.4-SNAPSHOTJason Zaugg2015-01-083-37/+3
|\ | | | | Bump to 0.9.4-SNAPSHOT
| * Bump to 0.9.4-SNAPSHOTJason Zaugg2015-01-083-37/+3
|/
* Merge pull request #100 from retronym/topic/tag-driven-releasev0.9.3_2.10v0.9.3-RC1_2.10Jason Zaugg2014-12-1810-7/+143
|\ | | | | Support tag driven publishing
| * Support tag driven publishingJason Zaugg2014-12-1810-7/+143
|/ | | | | | | | | | | | | | | | | I started with: https://github.com/scala/scala-swing/commit/a6a8e1d77e#diff-3acefdae08499733e855dd23e1af933dR8 And: - modified the regex that derives the version from the tag to handle the fact we have the scala binary version appended to our tags - Removed unnessary cross building with Scala 2.11 (as this is on the 2.10.x branch) - generated a key pair for the async repository - added passphrase for that key, and sonatype credentials, to sensitive.sbt - encrypted the secrets with the travis key.
* Merge pull request #98 from retronym/ticket/73Jason Zaugg2014-12-189-88/+166
|\ | | | | Make `f(await(completedFuture))` execute `f` synchronously
| * Make `f(await(completedFuture))` execute `f` synchronouslyJason Zaugg2014-12-164-35/+85
| | | | | | | | | | | | A worthy optimization, suggested by @danarmak. Closes #73
| * Remove extraneous method in generated code.Jason Zaugg2014-12-151-7/+2
| |
| * Avoid unbounded stack consumption for synchronous control flowJason Zaugg2014-12-157-54/+87
|/ | | | | | | | | | | | | | | | | | Previously, as sequence of state transitions that did not pass through an asynchrous boundary incurred stack frames. The trivial loop in the enclosed test case would then overflow the stack. This commit merges the `resume` and `apply(tr: Try[Any])` methods into a `apply`. It changes the body of this method to be an infinite loop with returns at the terminal points in the state machine (or at a terminal failure.) To allow merging of these previously separate matches, states that contain an await are now allocated two state ids: one for the setup code that calls `onComplete`, and one for the code in the continuation that records the result and advances the state machine. Fixes #93
* Merge pull request #91 from retronym/ticket/86-mkZeroJason Zaugg2014-09-304-7/+83
|\ | | | | Avoid assigning null to vars of derived value type
| * Avoid assigning null to vars of derived value typeJason Zaugg2014-09-294-7/+83
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `TreeGen#mkZero` returns `q"null"` for derived value classes. ``` scala> class V(val a: String) extends AnyVal defined class V scala> showRaw(gen.mkZero(typeOf[V])) res0: String = Literal(Constant(null)) ``` We use this API in async to generate the initial value for ANF-lifted temporary variables. However, this leads to NPEs, as after posterasure, we call the unbox method on a null reference: ``` % cat sandbox/Macro.scala; scalac-hash v2.10.4 sandbox/Macro.scala; scala-hash v2.10.4 -e 'val x = Macros.myMacro' import scala.reflect.macros.Context import scala.language.experimental.macros object Macros { def macroImpl(c: Context): c.Expr[C] = { import c.universe._ val e1 = c.Expr[C](Literal(Constant(null)).setType(typeOf[C])) reify(e1.splice.asInstanceOf[C @annotation.unchecked.uncheckedVariance]) } def myMacro: C = macro macroImpl } class C(val a: String) extends AnyVal java.lang.NullPointerException at Main$$anon$1.<init>(scalacmd4059893593754060829.scala:1) at Main$.main(scalacmd4059893593754060829.scala:1) at Main.main(scalacmd4059893593754060829.scala) ``` This commit installs a custom version of `mkZero` that instead returns `q"new C[$..targs](${mkZero(wrappedType)})`. Thanks to @ewiner for pinpointing the problem.
* 0.9.3-SNAPSHOTJason Zaugg2014-07-211-1/+1
|
* 0.9.2 for Scala 2.10v0.9.2_2.10Jason Zaugg2014-07-212-2/+2
|
* Merge pull request #80 from retronym/ticket/79Jason Zaugg2014-07-213-4/+70
|\ | | | | Fix regression around type skolems and if exprs.
| * Fix regression around type skolems and if exprs.Jason Zaugg2014-07-183-4/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we start with: async({ val res = await[S[_$1 with String]](s); if (true) await[Int](0) res }) Typechecking the application (before macro expansion) yields (where the trees are printed in the form `expr{tpe}`): async[S[_$1#5738 with String#137]]({ val res: S[_$1#5490 with String] forSome { type _$1#5490 } = await[S[_$1#5487 with String]]( s{S[_$1#5487 with String]} ){S[_$1#5487 with String]}; if (true) await(0) else () res{S[_$1#5738 with String]} }{S[_$1#5738 with String]}){S[_$1#5738 with String]} Note that the type of the second last line contains a skolemized symbol `_$1#5738` of the existential `_$1#5490`. This is created by this case in `Typer#adapt`: case et @ ExistentialType(_, _) if ((mode & (EXPRmode | LHSmode)) == EXPRmode) => adapt(tree setType et.skolemizeExistential(context.owner, tree), mode, pt, original) Our ANF rewrites part of this code to: <synthetic> val await$1: S[_$1#5487 with String] = await[S[_$1#5487 with String]](awaitable$1); val res: S[_$1#5490 with String] forSome { type _$1 } = await$1; And later, the state machine transformation splits the last line into a blank field and an assignment. Typechecking the `Assign` node led to the an type error. This commit manually attributes the types to the `Assign` node so as to avoid these problem. It also reigns in an overeager rewriting of `If` nodes in the ANF transform, which was due to a bug in the label detection logic introduced in 4fc5463538. Thanks to @gnovark for yet another devilish test case and analysis of the problem with label detection. I worked on a more principled fix on: https://github.com/retronym/async/compare/ticket/79-2?expand=1 in which I try to use `repackExistential` to convert skolemized types to existentials for use as the types of synthetic vals introduced by the ANF transform. This ran into a deeper problem with existential subtyping in the compiler itself though.
* | Merge pull request #82 from retronym/topic/live-variable-speedupPhilipp Haller2014-07-182-28/+120
|\ \ | | | | | | Fix asymptotic performance issues in live variables analysis.
| * | Fix asymptotic performance issues in live variables analysis.Gene Novark2014-07-152-28/+120
| |/ | | | | | | | | | | | | | | | | Fix possibly-exponential runtime for DFS graph searches. Improve DFA fixpoint algorithm to correctly compute worklist of only changed nodes for each iteration. Added test that takes > 2 minutes to compile without these improvements.
* | Merge pull request #75 from retronym/ticket/66Jason Zaugg2014-07-152-2/+17
|\ \ | |/ |/| Avoid NotImplementedError awaiting a Future[Nothing]
| * Avoid NotImplementedError awaiting a Future[Nothing]Jason Zaugg2014-06-142-2/+17
|/ | | | | | | `gen.mkZero(NothingTpe)` gives the tree `Predef.???`. Instead, we should leave the `await` field uninitialized with `ValDef(..., rhs = EmptyTree)`. Fixes #66
* 0.9.2-SNAPSHOTJason Zaugg2014-04-061-1/+1
|
* 0.9.1v0.9.1_2.10Jason Zaugg2014-04-062-2/+2
|
* Merge pull request #69 from retronym/backport/ticket/52-lazy-valPhilipp Haller2014-03-274-7/+39
|\ | | | | [backport] Allow lazy vals without await in the initializer
| * Incorporate pull request feedbackJason Zaugg2014-03-274-8/+3
| | | | | | | | | | | | | | | | | | - remove unneeded `setType(NoType)`, which was leftover from my first attempts to find this bug. - fix typo in error message - optimize imports (cherry picked from commit 5c6ea29966fa80faae13892da50fc68ed1bf9ae7)
| * [backport] Allow lazy vals without await in the initializerJason Zaugg2014-03-274-8/+45
|/ | | | | | | | | | | | | | | | | | | | | | | | We were incorrectly typechecking the `ClassDef` of the state machine in the macro in a way that discarded the resulting trees, and only kept around the symbol. The led to the the macro engine retypechecking that node, which somehow led to duplicated lazy val initiaializer `DefDef`-s in the template, which manifest as a `VerifyError`. This commit: - rescues the typechecked `ClassDef` node from the eager typechecking by the macro - loosens the restriction on lazy vals in async blocks. They are still prohibited if they contain an await on the RHS - Adds a test that shows evalution is indeed lazy. (cherry picked from commit cc4587b1985519f7049d0feb0783d8e22c10f792) Conflicts: src/main/scala/scala/async/internal/AsyncAnalysis.scala src/main/scala/scala/async/internal/AsyncTransform.scala
* 0.9.1-SNAPSHOTJason Zaugg2014-03-212-2/+2
|
* 0.9.0v0.9.0_2.10Jason Zaugg2014-03-211-1/+1
|
* Update to Scala 2.10.4Jason Zaugg2014-03-211-1/+1
|