Skip to content

Fix labeled tuple pattern location in parser, again. #2637

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
May 31, 2024
Merged
Changes from all commits
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
8 changes: 5 additions & 3 deletions ocaml/parsing/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -3529,10 +3529,12 @@ pattern_no_exn:
{ let loc = $loc(label) in
Some label, mkpatvar ~loc label }
| TILDE LPAREN label = LIDENT COLON cty = core_type RPAREN %prec COMMA
{ let loc = $loc(label) in
let pat = mkpatvar ~loc label in
Some label, mkpat_opt_constraint ~loc pat (Some cty) }
{ let lbl_loc = $loc(label) in
let pat_loc = $startpos($2), $endpos in
let pat = mkpatvar ~loc:lbl_loc label in
Some label, mkpat_opt_constraint ~loc:pat_loc pat (Some cty) }

(* If changing this, don't forget to change its copy just above. *)
%inline labeled_tuple_pat_element_noprec(self):
| self { None, $1 }
| LABEL simple_pattern
Expand Down
Loading