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

Coq prints {| |} but cannot parse it #13843

Open
gares opened this issue Feb 9, 2021 · 5 comments
Open

Coq prints {| |} but cannot parse it #13843

gares opened this issue Feb 9, 2021 · 5 comments
Labels
kind: bug An error, flaw, fault or unintended behaviour. part: parser The parser (also called gramlib, forked from camlp5) part: records Record types, Structures, etc.

Comments

@gares
Copy link
Member

gares commented Feb 9, 2021

If you define an empty record Coq prints its constructor a {| |} but then it cannot parse it back since it wants the name of a field.
IMO the notation system should check the number of fields in order to decide weather to use the notation or not.

CC @coq/extensible-syntax-maintainers

@herbelin
Copy link
Member

herbelin commented Feb 9, 2021

Hi @gares, can you give an example where an empty record is printed as {| |}? In any case, if it is so, why not to relax instead the expectation of at least one field, so that, e.g., if there is a type constraint, the notation {| |} is accepted?

@gares
Copy link
Member Author

gares commented Feb 10, 2021

That would be a better behaviour indeed

@gares
Copy link
Member Author

gares commented Feb 10, 2021

It took me a while, it needs to have parameters:

Module Bug. Record foo (A : Type) := {}. End Bug.
Definition bug := Bug.Build_foo nat.
Print bug.
(*
bug = {| |}
     : Bug.foo nat
*)

@gares
Copy link
Member Author

gares commented Feb 10, 2021

I guess there is already a test to see if the record is empty (and print the constructor name instead) but the test does not consider that some arguments of the constructor are not fields.

@gares
Copy link
Member Author

gares commented Feb 19, 2021

In addition to that, if the record has parameters, they are hidden by the {| ... |} even if Set Printing Implicits is on

@Alizter Alizter added kind: bug An error, flaw, fault or unintended behaviour. part: parser The parser (also called gramlib, forked from camlp5) part: records Record types, Structures, etc. labels Aug 11, 2021
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. part: parser The parser (also called gramlib, forked from camlp5) part: records Record types, Structures, etc.
Projects
None yet
Development

No branches or pull requests

3 participants