Skip to content

Commit 5ba4649

Browse files
committed
Remove instances of @ns.optional from tests.
There's a dedicated syntax for that. And, moving away from `ns.*` to a uniform `res.*`.
1 parent bd8854d commit 5ba4649

File tree

9 files changed

+513
-859
lines changed

9 files changed

+513
-859
lines changed

jscomp/main/builtin_cmi_datasets.ml

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

jscomp/others/jsxDOMStyle.ml

Lines changed: 0 additions & 779 deletions
This file was deleted.

jscomp/others/jsxDOMStyle.res

Lines changed: 436 additions & 0 deletions
Large diffs are not rendered by default.

jscomp/others/release.ninja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ o others/js_weakmap.cmi others/js_weakmap.cmj : cc others/js_weakmap.ml | others
6666
o others/js_weakset.cmi others/js_weakset.cmj : cc others/js_weakset.ml | others/belt_internals.cmi others/js.cmi $bsc
6767
o others/jsx.cmi others/jsx.cmj : cc others/jsx.res | others/belt_internals.cmi others/js.cmi $bsc
6868
o others/jsxDOM.cmi others/jsxDOM.cmj : cc others/jsxDOM.res | others/belt_internals.cmi others/js.cmi others/jsx.cmj others/jsxDOMStyle.cmj others/jsxEvent.cmj $bsc
69-
o others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj : cc others/jsxDOMStyle.ml | others/belt_internals.cmi others/js.cmi $bsc
69+
o others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj : cc others/jsxDOMStyle.res | others/belt_internals.cmi others/js.cmi $bsc
7070
o others/jsxEvent.cmi others/jsxEvent.cmj : cc others/jsxEvent.ml | others/belt_internals.cmi others/js.cmi $bsc
7171
o others/jsxPPXReactSupport.cmi others/jsxPPXReactSupport.cmj : cc others/jsxPPXReactSupport.res | others/belt_internals.cmi others/js.cmi others/jsx.cmj $bsc
7272
o js_pkg : phony others/js_OO.cmi others/js_OO.cmj others/js_array.cmi others/js_array.cmj others/js_array2.cmi others/js_array2.cmj others/js_bigint.cmi others/js_bigint.cmj others/js_cast.cmi others/js_cast.cmj others/js_console.cmi others/js_console.cmj others/js_date.cmi others/js_date.cmj others/js_dict.cmi others/js_dict.cmj others/js_exn.cmi others/js_exn.cmj others/js_float.cmi others/js_float.cmj others/js_global.cmi others/js_global.cmj others/js_int.cmi others/js_int.cmj others/js_json.cmi others/js_json.cmj others/js_list.cmi others/js_list.cmj others/js_map.cmi others/js_map.cmj others/js_mapperRt.cmi others/js_mapperRt.cmj others/js_math.cmi others/js_math.cmj others/js_null.cmi others/js_null.cmj others/js_null_undefined.cmi others/js_null_undefined.cmj others/js_obj.cmi others/js_obj.cmj others/js_option.cmi others/js_option.cmj others/js_promise.cmi others/js_promise.cmj others/js_promise2.cmi others/js_promise2.cmj others/js_re.cmi others/js_re.cmj others/js_result.cmi others/js_result.cmj others/js_set.cmi others/js_set.cmj others/js_string.cmi others/js_string.cmj others/js_string2.cmi others/js_string2.cmj others/js_typed_array.cmi others/js_typed_array.cmj others/js_typed_array2.cmi others/js_typed_array2.cmj others/js_types.cmi others/js_types.cmj others/js_undefined.cmi others/js_undefined.cmj others/js_vector.cmi others/js_vector.cmj others/js_weakmap.cmi others/js_weakmap.cmj others/js_weakset.cmi others/js_weakset.cmj others/jsx.cmi others/jsx.cmj others/jsxDOM.cmi others/jsxDOM.cmj others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj others/jsxEvent.cmi others/jsxEvent.cmj others/jsxPPXReactSupport.cmi others/jsxPPXReactSupport.cmj

jscomp/test/record_regression.res

Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// @@config({flags: ["-bs-diagnose"] })
22

3-
type t0 = {x: int, @ns.optional y: int, @ns.optional yy: option<int>, z: int}
3+
type t0 = {x: int, y?: int, yy?: option<int>, z: int}
44

55
let f1 = {x: 3, z: 2}
66

@@ -31,30 +31,30 @@ let v2: r = {x: 3, y: None, z: 2}
3131

3232
type config = {
3333
x: int,
34-
@ns.optional y0: int,
35-
@ns.optional y1: int,
36-
@ns.optional y2: int,
37-
@ns.optional y3: int,
38-
@ns.optional y4: int,
39-
@ns.optional y5: int,
40-
@ns.optional y6: int,
41-
@ns.optional y7: int,
42-
@ns.optional y8: int,
43-
@ns.optional y9: int,
44-
@ns.optional y10: int,
45-
@ns.optional y11: int,
46-
@ns.optional y12: int,
47-
@ns.optional y13: int,
48-
@ns.optional y14: int,
49-
@ns.optional y15: int,
50-
@ns.optional y16: int,
51-
@ns.optional y17: int,
52-
@ns.optional y18: int,
53-
@ns.optional y19: int,
54-
@ns.optional y20: int,
55-
@ns.optional y21: int,
56-
@ns.optional y22: int,
57-
@ns.optional y23: int,
34+
y0?: int,
35+
y1?: int,
36+
y2?: int,
37+
y3?: int,
38+
y4?: int,
39+
y5?: int,
40+
y6?: int,
41+
y7?: int,
42+
y8?: int,
43+
y9?: int,
44+
y10?: int,
45+
y11?: int,
46+
y12?: int,
47+
y13?: int,
48+
y14?: int,
49+
y15?: int,
50+
y16?: int,
51+
y17?: int,
52+
y18?: int,
53+
y19?: int,
54+
y20?: int,
55+
y21?: int,
56+
y22?: int,
57+
y23?: int,
5858
z: int,
5959
}
6060

@@ -64,8 +64,8 @@ let h: config = {...v, y1: 22}
6464

6565
type small_config = {
6666
x: int,
67-
@ns.optional y0: int,
68-
@ns.optional y1: int,
67+
y0?: int,
68+
y1?: int,
6969
z: int,
7070
}
7171

@@ -78,15 +78,15 @@ let h11 = (v1): small_config => {
7878
}
7979

8080
type partiallyOptional = {
81-
@ns.optional aa: int,
81+
aa?: int,
8282
bb: option<int>,
8383
}
8484

8585
let po = {aa: 3, bb: Some(4)}
8686

87-
let _ = {...po, aa: @ns.optional None}
87+
let _ = {...po, aa: ?None}
8888

89-
let setAA = (ao: option<int>) => {aa: @ns.optional ao, bb: None}
89+
let setAA = (ao: option<int>) => {aa: ?ao, bb: None}
9090

9191
type inlinedOptional = V0({x0: string, x1?: string, x2?: int, x3: int}) | V1({y0: string, y1: int})
9292

@@ -96,29 +96,30 @@ let ir2 = V0({x0: "v0", x1: "v1", x2: 2, x3: 3})
9696
let ir3 = V1({y0: "v0", y1: 1})
9797

9898
let pm0 = switch ir0 {
99-
| V0({x0, x3}) => (x0, x3)
100-
| V1({y0, y1}) => (y0, y1)
99+
| V0({x0, x3}) => (x0, x3)
100+
| V1({y0, y1}) => (y0, y1)
101101
}
102102
let pm1 = switch ir1 {
103-
| V0({x0, x1, x3}) => (x0, x1, x3)
104-
| V0({x0, x1: ?None, x3}) => (x0, "n/a", x3)
105-
| V1({y0, y1}) => (y0, "n/a", y1)
103+
| V0({x0, x1, x3}) => (x0, x1, x3)
104+
| V0({x0, x1: ?None, x3}) => (x0, "n/a", x3)
105+
| V1({y0, y1}) => (y0, "n/a", y1)
106106
}
107107
let pm2 = switch ir2 {
108-
| V0({x0, x1, x2, x3}) => (x0, x1, x2, x3)
109-
| V0({x0, x1: ?None, x2, x3}) => (x0, "n/a", x2, x3)
110-
| V0({x0, x1, x2: ?None, x3}) => (x0, x1, 0, x3)
111-
| V0({x0, x1: ?None, x2: ?None, x3}) => (x0, "n/a", 0, x3)
112-
| V1({y0, y1}) => (y0, "n/a", 0, y1)
108+
| V0({x0, x1, x2, x3}) => (x0, x1, x2, x3)
109+
| V0({x0, x1: ?None, x2, x3}) => (x0, "n/a", x2, x3)
110+
| V0({x0, x1, x2: ?None, x3}) => (x0, x1, 0, x3)
111+
| V0({x0, x1: ?None, x2: ?None, x3}) => (x0, "n/a", 0, x3)
112+
| V1({y0, y1}) => (y0, "n/a", 0, y1)
113113
}
114-
let inlinedRecord = ir => switch ir {
114+
let inlinedRecord = ir =>
115+
switch ir {
115116
| V0({x0, x1: ?Some("x1"), x2, x3}) => (x0, "x1", x2, x3)
116117
| V0({x0, x1: "xx1", x2, x3}) => (x0, "xx1", x2, x3)
117118
| V0({x0, x1, x2, x3}) => (x0, x1, x2, x3)
118119
| V0({x0, x1: ?None, x2, x3}) => (x0, "n/a", x2, x3)
119120
| V0({x0, x1, x2: ?None, x3}) => (x0, x1, 0, x3)
120121
| V0({x0, x1: ?None, x2: ?None, x3}) => (x0, "n/a", 0, x3)
121122
| V1({y0, y1}) => (y0, "n/a", 0, y1)
122-
}
123+
}
123124
let pm3 = inlinedRecord(ir2)
124125
let pm4 = inlinedRecord(ir3)

jscomp/test/res_debug.res

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
@@config({
2-
flags: [
3-
/* "-w";
4-
"@A" */
5-
/* "-drawlambda"; */
6-
/* "-dtypedtree"; */
7-
/* "-bs-diagnose"; */
8-
// "-dparsetree",
9-
/* "-dsource"; */
10-
],
2+
flags: [/* "-w";
3+
"@A" */
4+
/* "-drawlambda"; */
5+
/* "-dtypedtree"; */
6+
/* "-bs-diagnose"; */
7+
// "-dparsetree",
8+
/* "-dsource"; */],
119
})
1210
type t = {x: int, y: int}
1311

@@ -23,31 +21,29 @@ let f = (window, a, b) => {
2321
// let h = () => {
2422
// // external hi : int => int = "hi"
2523
// let h = 3
26-
// h
24+
// h
2725

2826
// }
2927

3028
type r = {
31-
x: int,
32-
@ns.optional y: int,
33-
z : int
29+
x: int,
30+
y?: int,
31+
z: int,
3432
}
3533

36-
let v0 = { x : 3 , z : 2 }
34+
let v0 = {x: 3, z: 2}
3735

36+
let v2 = {...v0, x: 3}
3837

39-
40-
41-
let v2 = { ... v0 , x : 3 }
42-
43-
let v1 : r = { x : 3
44-
, z : 3
38+
let v1: r = {
39+
x: 3,
40+
z: 3,
4541
}
4642

4743
let testMatch = v =>
4844
switch v {
4945
| {y} => y
50-
| {y: @ns.optional None} => 42
46+
| {y: ?None} => 42
5147
}
5248

5349
let h = '😊'

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

lib/4.06.1/unstable/js_playground_compiler.ml

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

lib/4.06.1/whole_compiler.ml

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)