-
-
Notifications
You must be signed in to change notification settings - Fork 249
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
Error quality of life: Forgetting to assign a ??
expression leads to a suprising error?
#2037
Comments
No this is correct. This is most surely a bug. |
It's also not clear what the user intended: foo = foo ?? faults::FOO?;
// or
foo ?? faults::FOO?!; |
I think this is the perfect error message |
This is a general check on discards though, how would you detect and make a reasonable error message? |
Check if the optional was not assigned to a value or rethrown or panic. In that instance would adjust the error to mention: "Error: An optional value was discarded, you can assign it to a variable, ignore it with a void cast '(void)', rethrow on optional with '!' or panic '!!' to avoid this error." |
I've updated it now, see if it's better. |
Looks great, gives a nice nudge to the solution 👍 |
Not sure about this one, but I'll see what you think:
The text was updated successfully, but these errors were encountered: