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 =
1815
1815
and parse_regex p pattern flags =
1816
1816
let start_pos = p.Parser. start_pos in
1817
1817
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
1819
1827
let payload =
1820
1828
Parsetree. PStr
1821
1829
[
@@ -1826,7 +1834,7 @@ and parse_regex p pattern flags =
1826
1834
if p.mode = ParseForTypeChecker then Some " js" else None )));
1827
1835
]
1828
1836
in
1829
- Ast_helper.Exp. extension (Location. mknoloc " re" , payload)
1837
+ Ast_helper.Exp. extension (Location. mkloc " re" loc , payload)
1830
1838
1831
1839
(* Atomic expressions represent unambiguous expressions.
1832
1840
* This means that regardless of the context, these expressions
Original file line number Diff line number Diff line change 1
1
2
2
[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 }
4
8
5
9
This has type: [1;31mRegExp.t[0m
6
10
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