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

Need specific messages for semantic restrictions in the "destruct" tactic. #14409

Open
jfehrle opened this issue May 30, 2021 · 3 comments
Open
Labels
kind: bug An error, flaw, fault or unintended behaviour. kind: user messages Improvement of error messages, new warnings, etc. part: tactics

Comments

@jfehrle
Copy link
Member

jfehrle commented May 30, 2021

I noticed some odd handling of semantic restrictions in "destruct" that we may want to clean up.

  • The action routine for induction_clause_list applies a semantic restriction, for which it calls err, raising Stream.Failure, which is misleadingly reported as a syntax error. For example, destruct x at 1 using H at 1. gives Syntax error: [induction_clause_list] expected after 'destruct' (in [simple_tactic]). The semantic restriction should be reported with a specific message, e.g. "'at' clause not permitted here; the destruction argument already has an 'at' clause"
  • The opt_clause on the end of induction_clause_list is not permitted (Ex: destruct x, y using H at 1) when there is more than one destruction_arg. This should probably get a separate specific message. I expect this opt_clause was added as a syntactic convenience for users, but it seems somewhat limited in its applicability and requires a bit of extra description in the doc.

I suggest we should give specific messages for these rather than syntax errors.

image

@jfehrle jfehrle added part: tactics kind: bug An error, flaw, fault or unintended behaviour. labels May 30, 2021
@jfehrle
Copy link
Member Author

jfehrle commented May 30, 2021

Also, the grammar in the screenshot is clearly ambiguous (though AFAIK the parser does the right thing)!

Attn: @herbelin @Zimmi48

@jfehrle
Copy link
Member Author

jfehrle commented May 30, 2021

Also notice that the screenshot grammar suggests that destruct x at 1 at 2. is valid, which is not.

@Zimmi48 Zimmi48 added the kind: user messages Improvement of error messages, new warnings, etc. label Jun 10, 2021
@Zimmi48
Copy link
Member

Zimmi48 commented Jun 10, 2021

The semantic restriction should be reported with a specific message, e.g. "'at' clause not permitted here; the destruction argument already has an 'at' clause"

I agree that semantic error messages are generally clearer (and thus preferable) to parsing errors.

The opt_clause should be a goal_occurrences in the documented grammar (and probably even in the code?). And I don't understand why its use is restricted. Maybe this limitation could be lifted?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug An error, flaw, fault or unintended behaviour. kind: user messages Improvement of error messages, new warnings, etc. part: tactics
Projects
None yet
Development

No branches or pull requests

2 participants