Skip to content

Commit

Permalink
fix(compiler): Correct locations for data constructor idents (#1752)
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Mar 16, 2023
1 parent 534bdca commit d015a97
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/src/parsing/parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ provide_stmt:
| attributes PROVIDE module_stmt { Toplevel.module_ ~loc:(to_loc $loc) ~attributes:$1 Provided $3 }

data_constructor:
| UIDENT { ConstructorDeclaration.singleton ~loc:(to_loc $loc) (mkstr $loc $1) }
| UIDENT lparen typs? rparen { ConstructorDeclaration.tuple ~loc:(to_loc $loc) (mkstr $loc $1) (Location.mkloc (Option.value ~default:[] $3) (to_loc $loc($3))) }
| UIDENT data_labels { ConstructorDeclaration.record ~loc:(to_loc $loc) (mkstr $loc $1) (Location.mkloc $2 (to_loc $loc($2))) }
| UIDENT { ConstructorDeclaration.singleton ~loc:(to_loc $loc) (mkstr $loc($1) $1) }
| UIDENT lparen typs? rparen { ConstructorDeclaration.tuple ~loc:(to_loc $loc) (mkstr $loc($1) $1) (Location.mkloc (Option.value ~default:[] $3) (to_loc $loc($3))) }
| UIDENT data_labels { ConstructorDeclaration.record ~loc:(to_loc $loc) (mkstr $loc($1) $1) (Location.mkloc $2 (to_loc $loc($2))) }

data_constructors:
| lbrace lseparated_nonempty_list(comma, data_constructor) comma? rbrace { $2 }
Expand Down

0 comments on commit d015a97

Please sign in to comment.