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

Add X-is-a-statement-not-an-expression error messages #5047

Open
RustanLeino opened this issue Feb 2, 2024 · 0 comments
Open

Add X-is-a-statement-not-an-expression error messages #5047

RustanLeino opened this issue Feb 2, 2024 · 0 comments
Labels
area: error-reporting Clarity of the error reporting kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny

Comments

@RustanLeino
Copy link
Collaborator

Summary

Dafny makes a hard distinction between expressions and statements. Users can get these mixed up. When an expression context is trying to use a statement (other than those allowed in StmtExpr's), then it would be nice if the error message was more direct about this.

Background and Motivation

Here's an example:

function F(): int {
  for i := 0 to 10 {
  }
}

This currently gives invalid UnaryExpression. Better would be "it looks like your trying to use a for statement in an expression context, but a statement is not an expression".

Proposed Feature

Can this error be substituted in the Coco-generated code? Can it be checked in the parser without causing too many ambiguous-start-symbol errors from the parser generator?

Alternatives

No response

@RustanLeino RustanLeino added kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny area: error-reporting Clarity of the error reporting labels Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: error-reporting Clarity of the error reporting kind: enhancement Enhancements, feature requests, etc. These are NOT bugs, but ways we can improve Dafny
Projects
None yet
Development

No branches or pull requests

1 participant