Skip to content

Commit

Permalink
fail if pattern guarded case has pc_guard set
Browse files Browse the repository at this point in the history
  • Loading branch information
rajgodse committed Aug 15, 2023
1 parent 3bfd40f commit 64ac2cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ocaml/parsing/jane_syntax.ml
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,9 @@ module Pattern_guarded = struct
let fail_malformed ~loc =
Location.raise_errorf ~loc "Malformed pattern guarded case rhs"

let of_case { pc_lhs; pc_rhs } =
match pc_rhs.pexp_desc with
| Pexp_match (scrutinee, cases) ->
let of_case { pc_lhs; pc_guard; pc_rhs } =
match pc_guard, pc_rhs.pexp_desc with
| None, Pexp_match (scrutinee, cases) ->
Pg_case { lhs = pc_lhs; scrutinee; cases }
| _ -> fail_malformed ~loc:pc_rhs.pexp_loc

Expand Down

0 comments on commit 64ac2cd

Please sign in to comment.