Skip to content

NPE when a value class is assigned to a val inside async block #83

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

Closed
ewiner opened this issue Jul 21, 2014 · 8 comments · Fixed by #85
Closed

NPE when a value class is assigned to a val inside async block #83

ewiner opened this issue Jul 21, 2014 · 8 comments · Fixed by #85
Assignees
Labels
Milestone

Comments

@ewiner
Copy link

ewiner commented Jul 21, 2014

It appears that if you use a value class inside an async block, the async macro will throw a NullPointerException while it's trying to initialize the state machine. When I run this code:

class IntWrapper(val value: String) extends AnyVal

async {
  val uid = new IntWrapper("foo")
  await(Future(uid))
}

I get this error:

java.lang.NullPointerException
    at #worksheet#.stateMachine$macro$1$1.<init>(TestCase.sc1225847898409493360.tmp:11)
    at #worksheet#.#worksheet#(TestCase.sc1225847898409493360.tmp:9)
@retronym retronym added the bug label Jul 21, 2014
@retronym retronym added this to the 0.9.2 milestone Jul 21, 2014
@retronym retronym self-assigned this Jul 21, 2014
@retronym
Copy link
Member

Can you please try to reproduce this outside of the Scala worksheet to rule out that as a contributing factor? I can't reproduce it myself.

@ewiner
Copy link
Author

ewiner commented Jul 21, 2014

Yes, I first hit the problem in my application code, then I screwed up trying to make a minimal repro. I updated the bug report, this now breaks in the REPL and as a compiled file.

@retronym
Copy link
Member

What version of Scala-async and Scala are you using?

@ewiner
Copy link
Author

ewiner commented Jul 21, 2014

Scala 2.11.1, scala-async 0.9.1

retronym added a commit to retronym/async that referenced this issue Jul 21, 2014
This progressed along with the fix for scala#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 scala#83
@retronym
Copy link
Member

I had trouble reproducing it because it was already fixed in the snapshot version (both for 2.10 and 2.11). I've just committed a test case to back this up, and will release a new version of async tomorrow.

@ewiner
Copy link
Author

ewiner commented Jul 21, 2014

Great, thanks.

@retronym
Copy link
Member

I've just deployed scala-async 0.9.2 to Sonatype.

@retronym
Copy link
Member

See: #91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants