Skip to content

Merge 2.10.x to master #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 21, 2014

Conversation

retronym
Copy link
Member

No description provided.

retronym and others added 9 commits April 6, 2014 18:05
`gen.mkZero(NothingTpe)` gives the tree `Predef.???`. Instead, we should leave
 the `await` field uninitialized with `ValDef(..., rhs = EmptyTree)`.

Fixes scala#66
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.
Avoid NotImplementedError awaiting a Future[Nothing]
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 4fc5463.

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.
Fix asymptotic performance issues in live variables analysis.
Fix regression around type skolems and if exprs.
…ter-20140721

Conflicts:
	src/main/scala/scala/async/internal/AsyncTransform.scala
	src/main/scala/scala/async/internal/Lifter.scala
retronym added a commit that referenced this pull request Jul 21, 2014
@retronym retronym merged commit 5342427 into scala:master Jul 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants