Skip to content
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

Fix false "discarded non-Unit value" errors on @react classes #296

Merged
merged 2 commits into from
Oct 11, 2019

Conversation

oleg-py
Copy link
Contributor

@oleg-py oleg-py commented Oct 11, 2019

Macro-generated class body emitted calls to bump, which accepted => Unit.

Since last expression of that call was null.asInstanceOf[Snapshot], Scala would auto-discard that value, and emit a warning if user has -Ywarn-value-discard. That means a false positive warning for each @react class.

Explicitly returning () in the block fixes that for scalac lint.

Macro-generated class body emitted calls to `bump`, which accepted => Unit
Since last expression of that call was `null.asInstanceOf[Snapshot]`, Scala
would auto-discard that value, and emit a warning if user has
-Ywarn-value-discard. That means a false positive warning for each @react
class.

Explicitly returning () in the block fixes that for scalac lint.
Copy link
Owner

@shadaj shadaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @oleg-py! Would you mind adding a line to the changelog for this? Otherwise looks good to go!

@oleg-py
Copy link
Contributor Author

oleg-py commented Oct 11, 2019

Done

@shadaj
Copy link
Owner

shadaj commented Oct 11, 2019

Awesome, thanks so much again!

@shadaj shadaj merged commit 0c76ff2 into shadaj:master Oct 11, 2019
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