Skip to content

Commit eb85692

Browse files
authored
fix(compiler): Correct location of parmatch mismatch type error (#2259)
1 parent 66e5929 commit eb85692

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

compiler/src/typed/typepat.re

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ type error =
4545
| UnrefutedPattern(pattern)
4646
| InlineRecordPatternMisuse(Identifier.t, string, string);
4747

48-
let ident_empty = {
48+
let ident_empty = loc => {
4949
txt: Identifier.IdentName(Location.mknoloc("[]")),
50-
loc: Location.dummy_loc,
50+
loc,
5151
};
52-
let ident_cons = {
52+
let ident_cons = loc => {
5353
txt: Identifier.IdentName(Location.mknoloc("[...]")),
54-
loc: Location.dummy_loc,
54+
loc,
5555
};
5656

5757
exception Error(Location.t, Env.t, error);
@@ -687,22 +687,22 @@ and type_pat_aux =
687687
| PPatList(spl) =>
688688
let convert_list = (~loc, a) => {
689689
open Ast_helper;
690-
let empty = Pattern.tuple_construct(~loc, ident_empty, []);
690+
let empty = Pattern.tuple_construct(~loc, ident_empty(loc), []);
691691
let a = List.rev(a);
692692
switch (a) {
693693
| [] => empty
694694
| [base, ...rest] =>
695695
let base =
696696
switch (base) {
697697
| ListItem(pat) =>
698-
Pattern.tuple_construct(~loc, ident_cons, [pat, empty])
698+
Pattern.tuple_construct(~loc, ident_cons(loc), [pat, empty])
699699
| ListSpread(pat, _) => pat
700700
};
701701
List.fold_left(
702702
(acc, pat) => {
703703
switch (pat) {
704704
| ListItem(pat) =>
705-
Pattern.tuple_construct(~loc, ident_cons, [pat, acc])
705+
Pattern.tuple_construct(~loc, ident_cons(loc), [pat, acc])
706706
| ListSpread(_, loc) =>
707707
raise(
708708
SyntaxError(

0 commit comments

Comments
 (0)