Skip to content

Commit 3138be6

Browse files
committed
Rename @ns.optional to @res.optional
1 parent 079edea commit 3138be6

File tree

16 files changed

+77
-77
lines changed

16 files changed

+77
-77
lines changed

jscomp/main/builtin_cmi_datasets.ml

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

jscomp/ml/datarepr.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ let constructor_descrs ty_path decl cstrs =
113113
if cd_args = Cstr_tuple [] then incr num_consts else incr num_nonconsts;
114114
if cd_res = None then incr num_normal)
115115
cstrs;
116-
let has_optional attrs = Ext_list.exists attrs (fun ({txt },_) -> txt = "ns.optional") in
116+
let has_optional attrs = Ext_list.exists attrs (fun ({txt },_) -> txt = "res.optional") in
117117
let rec describe_constructors idx_const idx_nonconst = function
118118
[] -> []
119119
| {cd_id; cd_args; cd_res; cd_loc; cd_attributes} :: rem ->

jscomp/ml/printtyp.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ and tree_of_constructor cd =
926926
(name, args, Some ret)
927927

928928
and tree_of_label l =
929-
let opt = l.ld_attributes |> List.exists (fun ({txt}, _) -> txt = "ns.optional") in
929+
let opt = l.ld_attributes |> List.exists (fun ({txt}, _) -> txt = "res.optional") in
930930
let typ = match l.ld_type.desc with
931931
| Tconstr (p, [t1], _) when opt && Path.same p Predef.path_option -> t1
932932
| _ -> l.ld_type in

jscomp/ml/typecore.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ let check_optional_attr env ld attrs loc =
322322
raise (Error (loc, env, Field_not_optional (ld.lbl_name, ld.lbl_res)));
323323
true in
324324
Ext_list.exists attrs (fun ({txt}, _) ->
325-
txt = "ns.optional" && check_redundant ())
325+
txt = "res.optional" && check_redundant ())
326326

327327
(* unification inside type_pat*)
328328
let unify_pat_types loc env ty ty' =

jscomp/ml/typedecl.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ let transl_declaration env sdecl id =
358358
| (_,_,loc)::_ ->
359359
Location.prerr_warning loc Warnings.Constraint_on_gadt
360360
end;
361-
let has_optional attrs = Ext_list.exists attrs (fun ({txt },_) -> txt = "ns.optional") in
361+
let has_optional attrs = Ext_list.exists attrs (fun ({txt },_) -> txt = "res.optional") in
362362
let scstrs =
363363
Ext_list.map scstrs (fun ({pcd_args} as cstr) ->
364364
match pcd_args with
@@ -409,7 +409,7 @@ let transl_declaration env sdecl id =
409409
let tcstrs, cstrs = List.split (List.map make_cstr scstrs) in
410410
Ttype_variant tcstrs, Type_variant cstrs
411411
| Ptype_record lbls ->
412-
let has_optional attrs = Ext_list.exists attrs (fun ({txt },_) -> txt = "ns.optional") in
412+
let has_optional attrs = Ext_list.exists attrs (fun ({txt },_) -> txt = "res.optional") in
413413
let optionalLabels =
414414
Ext_list.filter_map lbls
415415
(fun lbl -> if has_optional lbl.pld_attributes then Some lbl.pld_name.txt else None) in

lib/4.06.1/unstable/all_ounit_tests.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43418,7 +43418,7 @@ let constructor_descrs ty_path decl cstrs =
4341843418
if cd_args = Cstr_tuple [] then incr num_consts else incr num_nonconsts;
4341943419
if cd_res = None then incr num_normal)
4342043420
cstrs;
43421-
let has_optional attrs = Ext_list.exists attrs (fun ({txt },_) -> txt = "ns.optional") in
43421+
let has_optional attrs = Ext_list.exists attrs (fun ({txt },_) -> txt = "res.optional") in
4342243422
let rec describe_constructors idx_const idx_nonconst = function
4342343423
[] -> []
4342443424
| {cd_id; cd_args; cd_res; cd_loc; cd_attributes} :: rem ->

lib/4.06.1/unstable/js_compiler.ml

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

lib/4.06.1/unstable/js_playground_compiler.ml

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

lib/4.06.1/whole_compiler.ml

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

res_syntax/cli/reactjs_jsx_v4.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ let getLabel str =
2727
| Optional str | Labelled str -> str
2828
| Nolabel -> ""
2929

30-
let optionalAttr = ({txt = "ns.optional"; loc = Location.none}, PStr [])
30+
let optionalAttr = ({txt = "res.optional"; loc = Location.none}, PStr [])
3131
let optionalAttrs = [optionalAttr]
3232

3333
let constantString ~loc str =

res_syntax/compiler-libs-406/printtyp.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ and tree_of_constructor cd =
926926
(name, args, Some ret)
927927

928928
and tree_of_label l =
929-
let opt = l.ld_attributes |> List.exists (fun ({txt}, _) -> txt = "ns.optional") in
929+
let opt = l.ld_attributes |> List.exists (fun ({txt}, _) -> txt = "res.optional") in
930930
let typ = match l.ld_type.desc with
931931
| Tconstr (p, [t1], _) when opt && Path.same p Predef.path_option -> t1
932932
| _ -> l.ld_type in

res_syntax/src/res_core.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ let jsxAttr = (Location.mknoloc "JSX", Parsetree.PStr [])
151151
let uncurriedAppAttr = (Location.mknoloc "res.uapp", Parsetree.PStr [])
152152
let ternaryAttr = (Location.mknoloc "ns.ternary", Parsetree.PStr [])
153153
let ifLetAttr = (Location.mknoloc "ns.iflet", Parsetree.PStr [])
154-
let optionalAttr = (Location.mknoloc "ns.optional", Parsetree.PStr [])
154+
let optionalAttr = (Location.mknoloc "res.optional", Parsetree.PStr [])
155155
let makeAwaitAttr loc = (Location.mkloc "res.await" loc, Parsetree.PStr [])
156156
let makeAsyncAttr loc = (Location.mkloc "res.async" loc, Parsetree.PStr [])
157157

res_syntax/src/res_parsetree_viewer.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ let filterParsingAttrs attrs =
209209
| ( {
210210
Location.txt =
211211
( "bs" | "res.uapp" | "ns.braces" | "ns.iflet" | "ns.namedArgLoc"
212-
| "ns.optional" | "ns.ternary" | "res.async" | "res.await"
212+
| "res.optional" | "ns.ternary" | "res.async" | "res.await"
213213
| "res.template" );
214214
},
215215
_ ) ->
@@ -348,7 +348,7 @@ let isIfLetExpr expr =
348348
let rec hasOptionalAttribute attrs =
349349
match attrs with
350350
| [] -> false
351-
| ({Location.txt = "ns.optional"}, _) :: _ -> true
351+
| ({Location.txt = "res.optional"}, _) :: _ -> true
352352
| _ :: attrs -> hasOptionalAttribute attrs
353353

354354
let hasAttributes attrs =

res_syntax/tests/oprint/oprint.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,4 +360,4 @@ type call = CleanStart
360360

361361
let f = (~a=1, ()) => 1
362362

363-
type opt = {x:int, @ns.optional y: option<string>}
363+
type opt = {x:int, y?: option<string>}

res_syntax/tests/parsing/grammar/expressions/expected/record.res.txt

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,32 @@ let r = { (make () : myRecord) with foo = bar }
1414
let r = { (make () : myRecord) with foo = bar }
1515
let r =
1616
{
17-
x = ((None)[@ns.optional ]);
18-
y = ((None)[@ns.optional ]);
19-
z = (((None : tt))[@ns.optional ])
17+
x = ((None)[@res.optional ]);
18+
y = ((None)[@res.optional ]);
19+
z = (((None : tt))[@res.optional ])
2020
}
21-
let z name = { name = ((name)[@ns.optional ]); x = 3 }
22-
let z name = { name = ((name)[@ns.optional ]); x = 3 }
23-
let z name = { name; x = ((x)[@ns.optional ]) }
24-
let zz name = { name; x = ((x)[@ns.optional ]) }
21+
let z name = { name = ((name)[@res.optional ]); x = 3 }
22+
let z name = { name = ((name)[@res.optional ]); x = 3 }
23+
let z name = { name; x = ((x)[@res.optional ]) }
24+
let zz name = { name; x = ((x)[@res.optional ]) }
2525
let _ =
2626
match z with
27-
| { x = ((None)[@ns.optional ]); y = ((None)[@ns.optional ]);
28-
z = (((None : tt))[@ns.optional ]) } -> 11
29-
| { name = ((name)[@ns.optional ]); x = 3 } -> 42
30-
| { name = ((name)[@ns.optional ]); x = 3 } -> 4242
31-
| { x = ((None)[@ns.optional ]); y = ((None)[@ns.optional ]);
32-
z = (((None : tt))[@ns.optional ]) } -> 11
33-
| { name = ((name)[@ns.optional ]); x = 3 } -> 42
34-
| { name = ((name)[@ns.optional ]); x = 3 } -> 4242
27+
| { x = ((None)[@res.optional ]); y = ((None)[@res.optional ]);
28+
z = (((None : tt))[@res.optional ]) } -> 11
29+
| { name = ((name)[@res.optional ]); x = 3 } -> 42
30+
| { name = ((name)[@res.optional ]); x = 3 } -> 4242
31+
| { x = ((None)[@res.optional ]); y = ((None)[@res.optional ]);
32+
z = (((None : tt))[@res.optional ]) } -> 11
33+
| { name = ((name)[@res.optional ]); x = 3 } -> 42
34+
| { name = ((name)[@res.optional ]); x = 3 } -> 4242
3535
type nonrec tt = {
3636
x: int ;
3737
y: string [@ns.opttinal ]}
3838
type nonrec ttt = {
3939
x: int ;
40-
y: string [@ns.optional ]}
40+
y: string [@res.optional ]}
4141
type nonrec multipleWithAttrs = {
4242
x: int ;
43-
y: string [@ns.optional ][@attr ]}
43+
y: string [@res.optional ][@attr ]}
4444
type nonrec singleWithAttrs = {
45-
y: string [@ns.optional ][@attr ]}
45+
y: string [@res.optional ][@attr ]}

res_syntax/tests/printer/expr/record.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ let _ = switch z {
8383
| {? name, x: 3} => 4242
8484
}
8585

86-
type tt = {x:int, @ns.optional y: string}
86+
type tt = {x:int, @res.optional y: string}
8787

8888
type ttt = {x:int, y?: string}
8989

0 commit comments

Comments
 (0)