-
Notifications
You must be signed in to change notification settings - Fork 464
/
Copy pathrecord.res
54 lines (37 loc) · 1.29 KB
/
record.res
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
let r = {a: expr}
let r = {a: expr,} // trailing comma
let r = {Parsetree.pexp_attributes: [], Parsetree.loc: loc}
// punning
let r = {a, b, c}
let r = {A.a, b}
let r = {A.a, b, C.c}
let r = {Parsetree.pexp_attributes, Parsetree.loc}
// trailing comma
let r = {Parsetree.pexp_attributes, Parsetree.loc,}
// with constraint
let r = {a: (expr : int), b: (x : string)}
// spread
let r = {...expr, pexp_attributes: []}
let r = {...expr, pexp_attributes: [], pexp_loc: loc}
let r = {...expr, pexp_attributes: [],} // trailing comma
// with type constraint on spread
let r = {...make() : myRecord, foo: bar}
let r = {...(make() : myRecord), foo: bar} // parens optional
let r = {x: ? None, y: ?None, z: ? (None:tt)}
let z = name => { name : ? name, x: 3}
let z = name => { ? name, x: 3}
let z = name => { name, ? x }
let zz = name => { name, ? x }
let _ = switch z {
| {x: ? None, y: ? None, z: ? (None:tt)} => 11
| {name: ? name, x: 3} => 42
| {? name, x: 3} => 4242
| {x: ? None, y: ? None, z: ? (None:tt)} => 11
| {name: ? name, x: 3} => 42
| {? name, x: 3} => 4242
}
type tt = {x:int, @ns.opttinal y : string}
type ttt = {x:int, y?: string}
type multipleWithAttrs = {x:int, @attr y?: string}
type singleWithAttrs = {@attr y?: string}
type inlineWithAttrs = | A({@as("VALUE") value: string})