File tree Expand file tree Collapse file tree 4 files changed +18
-8
lines changed
tests/build_tests/super_errors Expand file tree Collapse file tree 4 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -1815,7 +1815,15 @@ and parse_constrained_expr_region p =
18151815and parse_regex p pattern flags =
18161816 let start_pos = p.Parser. start_pos in
18171817 Parser. next p;
1818- let loc = mk_loc start_pos p.prev_end_pos in
1818+ let loc =
1819+ mk_loc
1820+ {
1821+ start_pos with
1822+ (* Account for the inserted leading `/` *)
1823+ pos_cnum = start_pos.pos_cnum - 1 ;
1824+ }
1825+ p.prev_end_pos
1826+ in
18191827 let payload =
18201828 Parsetree. PStr
18211829 [
@@ -1826,7 +1834,7 @@ and parse_regex p pattern flags =
18261834 if p.mode = ParseForTypeChecker then Some " js" else None )));
18271835 ]
18281836 in
1829- Ast_helper.Exp. extension (Location. mknoloc " re" , payload)
1837+ Ast_helper.Exp. extension (Location. mkloc " re" loc , payload)
18301838
18311839(* Atomic expressions represent unambiguous expressions.
18321840 * This means that regardless of the context, these expressions
Original file line number Diff line number Diff line change 11
22 [1;31mWe've found a bug for you![0m
3- [36m/.../fixtures/extract_from_none_file.res[0m
3+ [36m/.../fixtures/regex_literal.res[0m:[2m1:7-11[0m
4+
5+ [1;31m1[0m [2m│[0m while [1;31m/foo/[0m {
6+ 2 [2m│[0m ()
7+ 3 [2m│[0m }
48
59 This has type: [1;31mRegExp.t[0m
610 But a [1;33mwhile[0m loop condition must always be of type: [1;33mbool[0m
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ while / foo / {
2+ ()
3+ }
You can’t perform that action at this time.
0 commit comments