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

Clarifying the logic of levels in custom and constr entry rules (reopening of #13025) #17117

Merged
merged 8 commits into from Jun 1, 2023

Conversation

herbelin
Copy link
Member

@herbelin herbelin commented Jan 14, 2023

Kind: cleanup + small enhancements (reopening of #13025)

Note: This PR was originally to fix #13018 and #12775 but those were finally fixed by #13073. This PR is thus now about small enhancements and a more principled code. The header has been updated.

Synchronous overlay

@herbelin herbelin added kind: fix This fixes a bug or incorrect documentation. kind: cleanup Code removal, deprecation, refactorings, etc. part: notations The notation system. part: printer The printing mechanism of Coq. request: full CI Use this label when you want your next push to trigger a full CI. labels Jan 14, 2023
@herbelin herbelin added this to the 8.18+rc1 milestone Jan 14, 2023
@herbelin herbelin requested review from a team as code owners January 14, 2023 19:24
@coqbot-app coqbot-app bot removed the request: full CI Use this label when you want your next push to trigger a full CI. label Jan 14, 2023
herbelin added a commit to herbelin/github-coq that referenced this pull request Jan 15, 2023
@herbelin herbelin force-pushed the master+fix-printing-custom-no-level branch from 1e916c8 to c827679 Compare January 15, 2023 19:07
@coqbot-app coqbot-app bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Jan 15, 2023
@herbelin herbelin added request: full CI Use this label when you want your next push to trigger a full CI. and removed needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. labels Jan 15, 2023
@herbelin
Copy link
Member Author

@coqbot run full CI

@coqbot-app coqbot-app bot removed the request: full CI Use this label when you want your next push to trigger a full CI. label Jan 15, 2023
interp/notation.ml Outdated Show resolved Hide resolved
herbelin added a commit to herbelin/github-coq that referenced this pull request Jan 17, 2023
@herbelin herbelin force-pushed the master+fix-printing-custom-no-level branch from c827679 to f696872 Compare January 17, 2023 08:57
@coqbot-app coqbot-app bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Jan 17, 2023
@herbelin
Copy link
Member Author

@coqbot run full CI

@coqbot-app coqbot-app bot removed the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Jan 17, 2023
@herbelin
Copy link
Member Author

herbelin commented Feb 3, 2023

This was ready and needing a rebase before I reopened it. @proux01, you might be the best expert for assigning!

@github-actions github-actions bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Feb 14, 2023
type notation_entry_level = InConstrEntrySomeLevel | InCustomEntryLevel of string * entry_level

(* A notation entry with the level where the notation lives *)
type notation_entry_level = notation_entry * entry_level
Copy link
Contributor

Choose a reason for hiding this comment

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

This would have been a good opportunity to use a record IMHO.

type notation_entry_level = notation_entry * entry_level

(* Notation subentries, to be associated to the variables of the notation *)
type notation_entry_relative_level = notation_entry * (entry_relative_level * side option)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same

| None -> raise No_match
| Some coercion ->

let scopes = (InConstrEntrySomeLevel, snd scopes) in
let scopes = ((InConstrEntry,(LevelSome (*??*),None)), snd scopes) in
Copy link
Contributor

Choose a reason for hiding this comment

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

?

let level_of_notation ntn =
if is_numeral_in_constr (decompose_notation_key ntn) then
(* A primitive notation *)
(fst ntn, 0, []) (* TODO: string notations*)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would the string case be hard to complete?

@proux01 proux01 self-assigned this Feb 15, 2023
@coqbot-app coqbot-app bot added the stale This PR will be closed unless it is rebased. label May 19, 2023
@ppedrot
Copy link
Member

ppedrot commented May 27, 2023

This PR is now at risk of being auto-closed by the bot due to a rebase not happening. We should really be more proactive in merging intermediate cleanup PRs otherwise they just vanish.

@proux01 proux01 force-pushed the master+fix-printing-custom-no-level branch from af26871 to 24fa443 Compare May 30, 2023 08:59
proux01 pushed a commit to herbelin/github-coq that referenced this pull request May 30, 2023
@coqbot-app coqbot-app bot removed needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. stale This PR will be closed unless it is rebased. labels May 30, 2023
@github-actions github-actions bot added the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label May 30, 2023
@proux01
Copy link
Contributor

proux01 commented May 30, 2023

@coqbot run full ci

informations about the subentries: we remember whether we are at any
level, at the next level or at the self level.

Incidentally, we also take into account option Printing Parentheses in
custom entries.

This is a more principled fix to coq#12775/coq#13018 than coq#13073 (printing
bugs in custom entry rules with no explicit level).

Compared to "subentries", the name "entry_relative" insists on the
syntactic structure of the type rather than on its semantic origin,
since, after all, subentries are promoted as entries in the recursive
printing loop.
proux01 pushed a commit to herbelin/github-coq that referenced this pull request May 30, 2023
@proux01 proux01 force-pushed the master+fix-printing-custom-no-level branch from 24fa443 to 48b5178 Compare May 30, 2023 12:28
@coqbot-app coqbot-app bot removed the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label May 30, 2023
@proux01 proux01 force-pushed the master+fix-printing-custom-no-level branch from 48b5178 to 43bface Compare May 31, 2023 07:53
@proux01
Copy link
Contributor

proux01 commented May 31, 2023

@coqbot run full ci

@coqbot-app coqbot-app bot removed the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label May 31, 2023
@proux01
Copy link
Contributor

proux01 commented Jun 1, 2023

@coqbot merge now

@coqbot-app coqbot-app bot merged commit e3f4b26 into coq:master Jun 1, 2023
7 of 11 checks passed
@coqbot-app
Copy link
Contributor

coqbot-app bot commented Jun 1, 2023

@proux01: Please take care of the following overlays:

  • 17117-master+fix-printing-custom-no-level.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: cleanup Code removal, deprecation, refactorings, etc. kind: fix This fixes a bug or incorrect documentation. part: notations The notation system. part: printer The printing mechanism of Coq.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

custom entry without explicit level prints as constr instead
4 participants