-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Warning when assigning null to Unit #18722
Comments
Duh...I was clearly not thinking clearly when wrote this. In the sense that I probably don't really understand how |
Warnings are designed for when we are not thinking clearly! The error here is that it does not warn with Scala 2 emits both warnings:
I'll leave the ticket closed, but I think it is a bug. |
Also it drives me nuts that I expand the edit window, then github UI re-minimizes it. Thanks for listening. |
Thanks for taking a look. I agree, it would be clearer with the "discarded" warning. |
Thanks for opening the issue, I agree that it can be confusing, as assigning a value to Unit type acts in a special way, looks like #18723 will make the situation clearer |
Compiler version
3.3.0
Minimized example
Output Error/Warning message
Why this Error/Warning was not helpful
The message was unhelpful because...
...it's hard to understand why it is relevant in this scenario. I initially thought that it's perhaps not allowed to assign
null
to a value ofUnit
type, but since it's just a warning and not an error, then I guess it is. So I don't really understand at all why this warning appears here.Suggested improvement
It could be made more helpful by...
...not giving a warning at all, or at least changing the explanation if it's actually a legitimate warning.
The text was updated successfully, but these errors were encountered: