Skip to content

Conversation

@retronym
Copy link
Member

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.

Review by @phaller. I will submit a separate PR against the 2.10.x branch.

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 scala#52
  - remove unneeded `setType(NoType)`, which was leftover from my
    first attempts to find this bug.
  - fix typo in error message
  - optimize imports
@phaller
Copy link
Contributor

phaller commented Mar 27, 2014

LGTM

phaller added a commit that referenced this pull request Mar 27, 2014
Allow lazy vals without await in the initializer
@phaller phaller merged commit 5a49226 into scala:master Mar 27, 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.

2 participants