Skip to content

[refactoring] minor improvements to pattern typing#12531

Merged
gasche merged 3 commits intoocaml:trunkfrom
gasche:minor-improvements-to-pattern-typing
Sep 12, 2023
Merged

[refactoring] minor improvements to pattern typing#12531
gasche merged 3 commits intoocaml:trunkfrom
gasche:minor-improvements-to-pattern-typing

Conversation

@gasche
Copy link
Copy Markdown
Member

@gasche gasche commented Sep 4, 2023

I was trying to re-read the code computing partiality of pattern-matching in the type-checker and to test it. This PR contains three independent, minor improvements:

  1. indicate the Partial|Total status of typedtree nodes in the -dtypedtree output; because Total is vastly more frequent, only change the printing when Partial
  2. rename and label the partial_flag argument to type_pat (one of partial_flag:true and partial_flag:false means that we know that the match is partial without checking; can you guess which one?)
  3. label the fixed argument of instance_poly and instance_label (not obviously related: it was the last remaining unlabeled boolean arguments used in Typecore)

The patches should not change the behavior of the compiler (except the -dtypedtree output) and they should be trivial to review. They could be rejected if you found them (1) not useful or (2) not improving readability.

@gasche gasche changed the title [refactoring] mimprovements to pattern typing [refactoring] minor improvements to pattern typing Sep 4, 2023
@gasche gasche force-pushed the minor-improvements-to-pattern-typing branch from b40b6db to a94791b Compare September 5, 2023 14:34
(I'm not sure what 'fixed' means here, it comes all the way from
0a82360 without documentation, but it
is better to have the parameter name at the callsite than to know
nothing at all.)
@gasche gasche force-pushed the minor-improvements-to-pattern-typing branch from a94791b to 2c53a09 Compare September 12, 2023 19:08
Copy link
Copy Markdown
Member

@Octachron Octachron left a comment

Choose a reason for hiding this comment

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

The changes in the typedtree printer look useful, and I agree that decreasing boolean blindness increases readability here (in particular for the partiality_flag argument).

@gasche
Copy link
Copy Markdown
Member Author

gasche commented Sep 12, 2023

The AppVeyor failure is due to the flaky test forbidden.ml -- unrelated. Merging. Thanks!

@gasche gasche merged commit 7666fb6 into ocaml:trunk Sep 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants