aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Merge pull request #92 from retronym/merge/2.10.x-to-master-20140930Jason Zaugg2014-10-024-8/+106
|\ \ \ | | | | | | | | Merge 2.10.x to master (plus a test)
| * | | Additional tests and comments around mkZero for value classesJason Zaugg2014-10-012-1/+35
| | | |
| * | | Merge branch 'ticket/86-mkZero' into merge/2.10.x-to-master-20140930Jason Zaugg2014-10-014-9/+73
|/| | | | | |/ | |/| | | | | | | | | | | | | Conflicts: src/main/scala/scala/async/internal/AnfTransform.scala src/main/scala/scala/async/internal/AsyncTransform.scala src/test/scala/scala/async/run/toughtype/ToughType.scala
| * | 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.11.xv0.9.2_2.11Jason Zaugg2014-07-212-2/+2
| |
* | Merge branch '2.10.x'Jason Zaugg2014-07-210-0/+0
|\|
| * 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 #85 from retronym/ticket/83Jason Zaugg2014-07-211-0/+14
|\ \ | | | | | | Test case for already-fixed NPE with value classes
| * | Test case for already-fixed NPE with value classesJason Zaugg2014-07-211-0/+14
|/ / | | | | | | | | | | | | | | | | | | This progressed along with the fix for #66. `TreeGen.mkZero` is a bit of a minefield: first with `Nothing` and now with Value Classes. I wonder if we can provoke the same sort of bug in the compiler in places where this is used. Closes #83
* | Merge pull request #84 from retronym/merge/2.10.x-to-master-20140721Jason Zaugg2014-07-217-34/+211
|\ \ | | | | | | Merge 2.10.x to master
| * | Merge remote-tracking branch 'origin/2.10.x' into ↵Jason Zaugg2014-07-217-34/+211
|/| | | |/ | | | | | | | | | | | | merge/2.10.x-to-master-20140721 Conflicts: src/main/scala/scala/async/internal/AsyncTransform.scala src/main/scala/scala/async/internal/Lifter.scala
| * 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 #72 from qifun/patch-1Philipp Haller2014-07-181-1/+1
|\ \ | | | | | | Added the missed s
| * | Update TreeInterrogation.scala杨博 (Yang Bo)2014-04-161-1/+1
| | |
* | | Merge pull request #81 from retronym/topic/bump-scala-versionPhilipp Haller2014-07-152-2/+2
|\ \ \ | |/ / |/| | Bump to a non-RC Scala version
| * | Bump to a non-RC Scala versionJason Zaugg2014-07-152-2/+2
|/ /
* | 0.9.2-SNAPSHOTJason Zaugg2014-04-061-1/+1
| |
* | 0.9.1v0.9.1_2.11Jason Zaugg2014-04-062-2/+2
| |
* | Merge pull request #71 from retronym/topic/quasiquote-appliedJason Zaugg2014-04-063-17/+71
|\ \ | | | | | | Update to Scala 2.11.0-RC4, adapting to change in quasiquotes
| * | Refactoring in ANFTransformJason Zaugg2014-04-051-15/+2
| | | | | | | | | | | | | | | - simpler means to calculate `applyDepth` - remove unused binder
| * | Update to Scala 2.11.0-RC4, adapting to change in quasiquotesJason Zaugg2014-04-053-3/+70
|/ / | | | | | | | | | | | | | | Namely: https://github.com/scala/scala/pull/3656 I can't find a way to express a QQ that matches an constructor invocation *and* lets me bind a reference to the `New` tree. So I've dropped down to a borrowed version of `TreeInfo#Applied`.
* | Merge pull request #70 from retronym/merge/2.10.xJason Zaugg2014-03-270-0/+0
|\ \ | | | | | | Merge 2.10.x to master
| * | Merge remote-tracking branch 'origin/2.10.x' into merge/2.10.xJason Zaugg2014-03-270-0/+0
|/| | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | % export MB=$(git merge-base head origin/2.10.x) % git log --oneline --graph $MB..origin/2.10.x * 9b3bbe4 Merge pull request #69 from retronym/backport/ticket/52-lazy-val |\ | * cf19f02 Incorporate pull request feedback | * ee66e08 [backport] Allow lazy vals without await in the initializer |/ * 6808ce4 0.9.1-SNAPSHOT * a37cf65 0.9.0 * 8f9a0b1 Update to Scala 2.10.4 * b489738 0.9.0-SNAPSHOT * 5c83eb1 0.9.0-M6 * be38163 [backport] Test case for "not a class" crasher in live variable * 290c3be Fix substitution in release script message * c3384d8 Update release script for _2.10 tagging convention * e3027b1 Update version in README * 6b344fa 0.9.0-SNAPSHOT * 8fafd79 0.9.0-M5 * d76bd53 only build 2.10.x on this branch % git merge -s ours origin/2.10.x
| * 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
| |
| * 0.9.0-SNAPSHOTJason Zaugg2014-03-122-2/+2
| |
| * 0.9.0-M6v0.9.0-M6_2.10Jason Zaugg2014-03-121-1/+1
| |
| * [backport] Test case for "not a class" crasher in live variableJason Zaugg2014-03-121-0/+28
| | | | | | | | | | | | Works on the 2.10.x branch, so just backprting the test. Cherry picked from 6f6546ebfc26564843621e79d840209a5103d3c8.
| * Fix substitution in release script messageJason Zaugg2014-03-101-2/+2
| |
| * Update release script for _2.10 tagging conventionJason Zaugg2014-03-101-2/+2
| |
| * Update version in READMEJason Zaugg2014-03-101-1/+1
| |
| * 0.9.0-SNAPSHOTJason Zaugg2014-03-101-1/+1
| |
| * 0.9.0-M5v0.9.0-M5_2.10Jason Zaugg2014-03-101-1/+1
| |
| * only build 2.10.x on this branchJason Zaugg2014-03-101-6/+0
| |
* | Merge pull request #67 from retronym/ticket/52-lazy-valPhilipp Haller2014-03-274-7/+42
|\ \ | | | | | | 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
| * | Allow lazy vals without await in the initializerJason Zaugg2014-03-274-8/+48
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Fixes #52