Skip to content

Avoid dead code warnings for users of async. #132

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 5 commits into from
Jul 30, 2015

Conversation

retronym
Copy link
Member

No description provided.

retronym added 4 commits July 29, 2015 19:17
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.
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 scala#150 (the part reported in the comments, not the original ticket.)
By declararing the parameter of `async` as by-name.

Fixes scala#150 (the bug in the original ticket.)
This avoids leaving .class files in the working directory
after running the test.
@retronym retronym added this to the 0.9.6 milestone Jul 30, 2015
retronym added a commit that referenced this pull request Jul 30, 2015
Avoid dead code warnings for users of async.
@retronym retronym merged commit 5ee834d into scala:master Jul 30, 2015
@retronym
Copy link
Member Author

This fixes #105 (rather than 150, as incorrectly claimed in the commit comments.)

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.

1 participant