File tree Expand file tree Collapse file tree 6 files changed +34
-4
lines changed Expand file tree Collapse file tree 6 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -583,6 +583,7 @@ let rec parseLident p =
583
583
loop p
584
584
end
585
585
in
586
+ Parser. err p (Diagnostics. lident p.Parser. token);
586
587
Parser. next p;
587
588
loop p;
588
589
match p.Parser. token with
Original file line number Diff line number Diff line change 68
68
69
69
This let-binding misses an expression
70
70
71
+
72
+ Syntax error!
73
+ tests/parsing/errors/expressions/letBinding.res:15:12
74
+
75
+ 13 │ }
76
+ 14 │
77
+ 15 │ let foo as 'x = ()
78
+ 16 │
79
+
80
+ I'm expecting a lowercase name like `user or `age`
81
+
71
82
let foo = 2.
72
83
let foo = true
73
84
let foo = 2
74
85
let foo = f ()
75
86
let foo = ((2)[@ns.braces ])
76
- let foo = (("foo")[@ns.braces ])
87
+ let foo = (("foo")[@ns.braces ])
88
+ let foo as x = ()
Original file line number Diff line number Diff line change @@ -12,3 +12,4 @@ let foo = == {
12
12
"foo"
13
13
}
14
14
15
+ let foo as 'x = ()
Original file line number Diff line number Diff line change 4
4
5
5
1 │ let f = (x, y=2, z) => x + y + z
6
6
2 │
7
- 3 │ type f = (x: int, y: int ) => int
7
+ 3 │ let g = (~?x, ~y=2, ~z ) => x + y + z
8
8
9
9
A labeled parameter starts with a `~`. Did you mean: `~y`?
10
10
14
14
15
15
1 │ let f = (x, y=2, z) => x + y + z
16
16
2 │
17
- 3 │ type f = (x: int, y: int ) => int
17
+ 3 │ let g = (~?x, ~y=2, ~z ) => x + y + z
18
18
4 │
19
+ 5 │ type f = (x: int, y: int) => int
20
+
21
+ I'm expecting a lowercase name like `user or `age`
22
+
23
+
24
+ Syntax error!
25
+ tests/parsing/errors/other/labelledParameters.res:5:11
26
+
27
+ 3 │ let g = (~?x, ~y=2, ~z) => x + y + z
28
+ 4 │
29
+ 5 │ type f = (x: int, y: int) => int
30
+ 6 │
19
31
20
32
A labeled parameter starts with a `~`. Did you mean: `~x`?
21
33
22
34
let f x ?(y= 2) z = (x + y) + z
35
+ let g ~x:((x)[@ns.namedArgLoc ]) ?y:(((y)[@ns.namedArgLoc ])= 2)
36
+ ~z:((z)[@ns.namedArgLoc ]) = (x + y) + z
23
37
type nonrec f = x:int -> y:int -> int
Original file line number Diff line number Diff line change 1
1
let f = (x , y = 2 , z ) => x + y + z
2
2
3
+ let g = (~?x , ~y = 2 , ~z ) => x + y + z
4
+
3
5
type f = (x : int , y : int ) => int
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ let /* before */ 123 /* after */ = 123
11
11
// Ppat_interval of constant * constant
12
12
13
13
// Ppat_alias
14
- let /* before pat */ p /* after pat */ as /* before alias */ ' x /* after alias */ = ()
14
+ let /* before pat */ p /* after pat */ as /* before alias */ x /* after alias */ = ()
15
15
let /*c0 */ (/* c1 */ p /* c2 */ as /* c3 */ x /* c4*/ ) as /* c5 */ y /* c6 */ = ()
16
16
17
17
// Ppat_array
You can’t perform that action at this time.
0 commit comments