-
Notifications
You must be signed in to change notification settings - Fork 803
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
Improve Error Reporting: no expression in computation expression #6717
Comments
I like the suggestion, but I'd prefer it to be a bit shorter since we're showing too many options:
|
@cartermp yep. Maybe keep the
|
Sounds good. |
What do we need to do to move this out of "needs discussion" into "up for grabs"? |
I think this one could be considered up for grabs. The challenge here would be in detecting the pattern rather than emitting the parse error. |
Note to potential implementors - consider using this fantomas tools link to help you find the correct parse tree shapes on which to give the error. |
What
Consider the following code sample:
and the associated error message,
error FS0010: Unexpected symbol '}' in expression
.Why
The error message doesn't help understand why the error has occurred, nor given any guidance on how to fix it. In addition, the error occurs on the final line (with the
}
) rather than with thelet!
. See here for a sample of a real-world issue caused by this.How
Ending the block with a normal
let
gives a much better errorgives
The block following this 'let' is unfinished. Every code block is an expression and must have a result. 'let' cannot be the final code element in a block. Consider giving this block an explicit result.
(although I think that this message could still be improved...).How about this for let!s:
'let!' cannot be the final code element in a computation expression block. Consider replacing the use of let! with return! if this is the final expression in the block, or returning some value after this expression, or executing either a do! (or unit-returning) expression after this expression.
The text was updated successfully, but these errors were encountered: