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

Simple ADTs with a single constructor are records #1146

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/lib/frontend/d_cnf.ml
Original file line number Diff line number Diff line change
Expand Up @@ -975,8 +975,10 @@ let rec mk_expr
E.mk_record [] ty
| Tadt _ as ty ->
E.mk_constr (Uid.of_dolmen tcst) [] ty
| _ ->
assert false
| Tunit ->
E.void
| ty ->
Fmt.failwith "unexpected type %a@." Ty.print ty
Comment on lines +978 to +981
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a test that shows that Tunit is used? And that we crash if we don't match it here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 2000 regressions on ae-format without this case, so yes, we have tests :)
Actually the builtin unit type of Dolmen is an ADT but a distinct builtin type Tunit in Alt-Ergo. It's a corner corner corner case...

I tested this PR on ae-format and now there is no regression anymore ;)

Copy link
Collaborator Author

@Halbaroth Halbaroth Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add a unit test to catch unit (sic) case

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally, I removed the Ty.Tunit type of AE in #1148, so this corner case disappears.

end

| _ -> unsupported "Constant term %a" DE.Term.print term
Expand Down
Loading