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

destruct: Removal of residual patterns fix #1560 #1737

Merged

Conversation

xvw
Copy link
Collaborator

@xvw xvw commented Feb 23, 2024

The fix is actually ... very simple as pattern generation is assumed to be this way:

type t = A of int | B | C
let f = function A x -> x | _ -> 2 (* on _ we want to produces B | C *)
let g = function A x -> x | _ -> 1 | C -> 2 (* I assume that we want only generate B *)

So the idea is just to build the list of pattern in this order after, before, new_branches.
Understanding the problem was a bit complex (for such a small fix) as the names rev_before and after were confusing (Perhaps because the logic of pattern matching has changed significantly since the original implementation?). I can probably take advantage of the branch to do some renaming.

fix #1560

@xvw xvw force-pushed the 1560-destruct-should-not-produce-remanent-cases branch from 99ebdb8 to af62e12 Compare February 23, 2024 11:23
@xvw xvw changed the title destruct: Removal of residual patterns destruct: Removal of residual patterns fix #1560 Feb 23, 2024
Copy link
Collaborator

@voodoos voodoos left a comment

Choose a reason for hiding this comment

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

The test looks nice, that's a useful fix :-)

@voodoos voodoos merged commit 3488e07 into ocaml:master Feb 26, 2024
12 checks passed
@xvw xvw deleted the 1560-destruct-should-not-produce-remanent-cases branch February 26, 2024 10:09
voodoos added a commit to voodoos/merlin that referenced this pull request May 13, 2024
fixes ocaml#1560

from xvw/1560-destruct-should-not-produce-remanent-cases
voodoos added a commit to voodoos/opam-repository that referenced this pull request May 17, 2024
CHANGES:

Fri May 17 19:59:42 CET 2024

  + merlin binary
    - Support for OCaml 5.2 (ocaml/merlin#1757)
    - destruct: Removal of residual patterns (ocaml/merlin#1737, fixes ocaml/merlin#1560)
    - Do not erase fields' names when destructing punned record fields (ocaml/merlin#1734,
      fixes ocaml/merlin#1661)
    - Ignore SIGPIPE in the Merlin server process (ocaml/merlin#1746)
    - Fix lexing of quoted strings in comments (ocaml/merlin#1754, fixes ocaml/merlin#1753)
    - Improve cursor position detection in longidents (ocaml/merlin#1756)
    - Addition of a `merlin-lib.commands` library which disassociates the
      execution of commands from the `new_protocol`, from the binary, allowing
      it to be invoked from other projects (ocaml/merlin#1758)
    - New occurrences backend: Don't index occurrences when `merlin.hide`
      attribute is present. (ocaml/merlin#1768)
    - Use the new `uid_to_decl` table in 5.2's cmt files to get documentation.
      (ocaml/merlin#1773)
voodoos added a commit to voodoos/opam-repository that referenced this pull request May 31, 2024
CHANGES:

May May 31 14:02:42 CET 2024

  + merlin binary
    - destruct: Removal of residual patterns (ocaml/merlin#1737, fixes ocaml/merlin#1560)
    - Do not erase fields' names when destructing punned record fields (ocaml/merlin#1734,
      fixes ocaml/merlin#1661)
    - Ignore SIGPIPE in the Merlin server process (ocaml/merlin#1746)
    - Fix lexing of quoted strings in comments (ocaml/merlin#1754, fixes ocaml/merlin#1753)
    - Improve cursor position detection in longidents (ocaml/merlin#1756)
voodoos added a commit to voodoos/opam-repository that referenced this pull request May 31, 2024
CHANGES:

Fri May 31 14:02:42 CEST 2024

  + merlin binary
    - destruct: Removal of residual patterns (ocaml/merlin#1737, fixes ocaml/merlin#1560)
    - Do not erase fields' names when destructing punned record fields (ocaml/merlin#1734,
      fixes ocaml/merlin#1661)
    - Ignore SIGPIPE in the Merlin server process (ocaml/merlin#1746)
    - Fix lexing of quoted strings in comments (ocaml/merlin#1754, fixes ocaml/merlin#1753)
    - Improve cursor position detection in longidents (ocaml/merlin#1756)
voodoos added a commit to voodoos/opam-repository that referenced this pull request May 31, 2024
CHANGES:

Fri May 31 14:02:42 CEST 2024

  + merlin binary
    - destruct: Removal of residual patterns (ocaml/merlin#1737, fixes ocaml/merlin#1560)
    - Do not erase fields' names when destructing punned record fields (ocaml/merlin#1734,
      fixes ocaml/merlin#1661)
    - Ignore SIGPIPE in the Merlin server process (ocaml/merlin#1746)
    - Fix lexing of quoted strings in comments (ocaml/merlin#1754, fixes ocaml/merlin#1753)
    - Improve cursor position detection in longidents (ocaml/merlin#1756)
voodoos added a commit to voodoos/opam-repository that referenced this pull request May 31, 2024
CHANGES:

Fri May 31 14:02:42 CEST 2024

  + merlin binary
    - destruct: Removal of residual patterns (ocaml/merlin#1737, fixes ocaml/merlin#1560)
    - Do not erase fields' names when destructing punned record fields (ocaml/merlin#1734,
      fixes ocaml/merlin#1661)
    - Ignore SIGPIPE in the Merlin server process (ocaml/merlin#1746)
    - Fix lexing of quoted strings in comments (ocaml/merlin#1754, fixes ocaml/merlin#1753)
    - Improve cursor position detection in longidents (ocaml/merlin#1756)
avsm pushed a commit to avsm/opam-repository that referenced this pull request Sep 5, 2024
CHANGES:

Fri May 31 14:02:42 CEST 2024

  + merlin binary
    - destruct: Removal of residual patterns (ocaml/merlin#1737, fixes ocaml/merlin#1560)
    - Do not erase fields' names when destructing punned record fields (ocaml/merlin#1734,
      fixes ocaml/merlin#1661)
    - Ignore SIGPIPE in the Merlin server process (ocaml/merlin#1746)
    - Fix lexing of quoted strings in comments (ocaml/merlin#1754, fixes ocaml/merlin#1753)
    - Improve cursor position detection in longidents (ocaml/merlin#1756)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 5.0-501
Development

Successfully merging this pull request may close these issues.

Destruct shouldn't produce same patterns in an existing pattern-match
2 participants