Skip to content

Commit 6b860c2

Browse files
committed
adjust %@ issues, fix CI
1 parent 2082757 commit 6b860c2

File tree

7 files changed

+54
-54
lines changed

7 files changed

+54
-54
lines changed

jscomp/ounit_tests/ounit_cmd_tests.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ let suites =
5050
= ""
5151
[@@bs.send.pipe:int]
5252
[@@bs.splice]|}|] in
53-
OUnit.assert_bool __LOC__ (Ext_string.contain_substring v_output.stderr "bs.splice")
53+
OUnit.assert_bool __LOC__ (Ext_string.contain_substring v_output.stderr "variadic")
5454
end;
5555
__LOC__ >:: begin fun _ ->
5656
let v_output = perform_bsc [|"-bs-eval"; {|external
@@ -59,7 +59,7 @@ let suites =
5959
= ""
6060
[@@bs.send.pipe:int]
6161
[@@bs.splice] |}|] in
62-
OUnit.assert_bool __LOC__ (Ext_string.contain_substring v_output.stderr "bs.splice")
62+
OUnit.assert_bool __LOC__ (Ext_string.contain_substring v_output.stderr "variadic")
6363
end;
6464

6565
__LOC__ >:: begin fun _ ->

jscomp/outcome_printer/tweaked_reason_oprint.cppo.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,14 @@ and print_simple_out_type ppf =
316316
let res =
317317
if name = "arity0" then Otyp_arrow ("", Otyp_constr (Oide_ident "unit", []),ty)
318318
else ty in
319-
fprintf ppf "@[<0>(%a)@ [@meth]@]" (print_out_type_1 ~uncurried:false) res
319+
fprintf ppf "@[<0>(%a)@ [%@meth]@]" (print_out_type_1 ~uncurried:false) res
320320

321321
| Otyp_constr (
322322
Oide_dot (Oide_dot (
323323
Oide_ident "Js_OO", "Callback" ), _),
324324
[res]
325325
) ->
326-
fprintf ppf "@[<0>(%a)@ [@this]@]" (print_out_type_1 ~uncurried:false) res
326+
fprintf ppf "@[<0>(%a)@ [%@this]@]" (print_out_type_1 ~uncurried:false) res
327327

328328
(* also BuckleScript-specific. Turns Js.t({. foo: bar}) into {. "foo": bar} *)
329329
| Otyp_constr (

jscomp/syntax/ast_core_type_class_type.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ let typ_mapper
174174
| Uncurry attr , attrs ->
175175
attrs, attr +> ty
176176
| Method _, _
177-
-> Location.raise_errorf ~loc "@get/set conflicts with @meth"
177+
-> Location.raise_errorf ~loc "%@get/set conflicts with %@meth"
178178
| Meth_callback attr, attrs ->
179179
attrs, attr +> ty
180180
in
@@ -186,7 +186,7 @@ let typ_mapper
186186
| Uncurry attr, attrs ->
187187
attrs, attr +> ty
188188
| Method _, _
189-
-> Location.raise_errorf ~loc "@get/set conflicts with @meth"
189+
-> Location.raise_errorf ~loc "%@get/set conflicts with %@meth"
190190
| Meth_callback attr, attrs ->
191191
attrs, attr +> ty
192192
in

jscomp/syntax/ast_external_process.ml

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -339,11 +339,11 @@ let parse_external_attributes
339339
| "bs.new" | "new" -> {st with new_name = name_from_payload_or_prim ~loc payload}
340340
| "bs.set_index" | "set_index" ->
341341
if String.length prim_name_check <> 0 then
342-
Location.raise_errorf ~loc "@set_index this particular external's name needs to be a placeholder empty string";
342+
Location.raise_errorf ~loc "%@set_index this particular external's name needs to be a placeholder empty string";
343343
{st with set_index = true}
344344
| "bs.get_index" | "get_index" ->
345345
if String.length prim_name_check <> 0 then
346-
Location.raise_errorf ~loc "@get_index this particular external's name needs to be a placeholder empty string";
346+
Location.raise_errorf ~loc "%@get_index this particular external's name needs to be a placeholder empty string";
347347
{st with get_index = true}
348348
| "bs.obj" | "obj" -> {st with mk_obj = true}
349349
| "bs.return" | "return" ->
@@ -428,7 +428,7 @@ let process_obj
428428
TODO: better error message *)
429429
} ->
430430
if String.length prim_name <> 0 then
431-
Location.raise_errorf ~loc "@@obj expect external names to be empty string";
431+
Location.raise_errorf ~loc "%@obj expect external names to be empty string";
432432
let arg_kinds, new_arg_types_ty, (result_types : Parsetree.object_field list) =
433433
Ext_list.fold_right arg_types_ty ( [], [], [])
434434
(fun param_type ( arg_labels, (arg_types : Ast_compatible.param_type list), result_types) ->
@@ -474,15 +474,15 @@ let process_obj
474474
(Otag({Asttypes.txt = name; loc}, [], Ast_literal.type_string ~loc ()) :: result_types)
475475
| Fn_uncurry_arity _ ->
476476
Location.raise_errorf ~loc
477-
"The combination of @@obj, @@uncurry is not supported yet"
477+
"The combination of %@obj, %@uncurry is not supported yet"
478478
| Extern_unit -> assert false
479479
| Poly_var _
480480
->
481481
Location.raise_errorf ~loc
482-
"@@obj label %s does not support such arg type" name
482+
"%@obj label %s does not support such arg type" name
483483
| Unwrap ->
484484
Location.raise_errorf ~loc
485-
"@@obj label %s does not support @unwrap arguments" name
485+
"%@obj label %s does not support %@unwrap arguments" name
486486
end
487487
| Optional name ->
488488
let obj_arg_type = get_opt_arg_type ~nolabel:false ty in
@@ -507,18 +507,18 @@ let process_obj
507507
(Otag ({Asttypes.txt = name; loc}, [], Ast_comb.to_undefined_type loc @@ Ast_literal.type_string ~loc ()) :: result_types)
508508
| Arg_cst _
509509
->
510-
Location.raise_errorf ~loc "@@as is not supported with optional yet"
510+
Location.raise_errorf ~loc "%@as is not supported with optional yet"
511511
| Fn_uncurry_arity _ ->
512512
Location.raise_errorf ~loc
513-
"The combination of @@obj, @@uncurry is not supported yet"
513+
"The combination of %@obj, %@uncurry is not supported yet"
514514
| Extern_unit -> assert false
515515
| Poly_var _
516516
->
517517
Location.raise_errorf ~loc
518-
"@@obj label %s does not support such arg type" name
518+
"%@obj label %s does not support such arg type" name
519519
| Unwrap ->
520520
Location.raise_errorf ~loc
521-
"@@obj label %s does not support @unwrap arguments" name
521+
"%@obj label %s does not support %@unwrap arguments" name
522522
end
523523
in
524524
new_arg_label::arg_labels,
@@ -535,7 +535,7 @@ let process_obj
535535
in
536536
Ast_compatible.mk_fn_type new_arg_types_ty result,
537537
External_ffi_types.ffi_obj_create arg_kinds
538-
| _ -> Location.raise_errorf ~loc "Attribute found that conflicts with @@obj"
538+
| _ -> Location.raise_errorf ~loc "Attribute found that conflicts with %@obj"
539539

540540

541541
let external_desc_of_non_obj
@@ -568,9 +568,9 @@ let external_desc_of_non_obj
568568
if arg_type_specs_length = 3 then
569569
Js_set_index {js_set_index_scopes = scopes}
570570
else
571-
Location.raise_errorf ~loc "Ill defined attribute @set_index (arity of 3)"
571+
Location.raise_errorf ~loc "Ill defined attribute %@set_index (arity of 3)"
572572
| {set_index = true; _} ->
573-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with @set_index")
573+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with %@set_index")
574574
| {get_index = true;
575575
val_name = `Nm_na;
576576
external_module_name = None ;
@@ -591,10 +591,10 @@ let external_desc_of_non_obj
591591
if arg_type_specs_length = 2 then
592592
Js_get_index {js_get_index_scopes = scopes}
593593
else Location.raise_errorf ~loc
594-
"Ill defined attribute @get_index (arity expected 2 : while %d)" arg_type_specs_length
594+
"Ill defined attribute %@get_index (arity expected 2 : while %d)" arg_type_specs_length
595595

596596
| {get_index = true; _} ->
597-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with @get_index")
597+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with %@get_index")
598598
| {module_as_val = Some external_module_name ;
599599

600600
get_index = false;
@@ -617,17 +617,17 @@ let external_desc_of_non_obj
617617
| [], `Nm_na, _ -> Js_module_as_var external_module_name
618618
| _, `Nm_na, _ -> Js_module_as_fn {splice; external_module_name }
619619
| _, #bundle_source, #bundle_source ->
620-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with @@module.")
620+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with %@module.")
621621

622622
| _, (`Nm_val _ | `Nm_external _) , `Nm_na
623623
-> Js_module_as_class external_module_name
624624
| _, `Nm_payload _ , `Nm_na
625625
->
626626
Location.raise_errorf ~loc
627-
"Incorrect FFI attribute found: (@new should not carry a payload here)"
627+
"Incorrect FFI attribute found: (%@new should not carry a payload here)"
628628
end
629629
| {module_as_val = Some _; _} ->
630-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with @@module.")
630+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with %@module.")
631631
| {call_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name) ;
632632
splice;
633633
scopes ;
@@ -649,7 +649,7 @@ let external_desc_of_non_obj
649649
Js_call {splice; name; external_module_name; scopes }
650650
| {call_name = #bundle_source ; _ }
651651
->
652-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with @val")
652+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with %@val")
653653
| {val_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name);
654654
external_module_name;
655655

@@ -676,7 +676,7 @@ let external_desc_of_non_obj
676676
Js_var { name; external_module_name; scopes}
677677
| {val_name = #bundle_source ; _ }
678678
->
679-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with @val")
679+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with %@val")
680680

681681
| {splice ;
682682
scopes ;
@@ -726,16 +726,16 @@ let external_desc_of_non_obj
726726
begin match arg_type_specs with
727727
| [] ->
728728
Location.raise_errorf
729-
~loc "Ill defined attribute @send(the external needs to be a regular function call with at least one argument)"
729+
~loc "Ill defined attribute %@send(the external needs to be a regular function call with at least one argument)"
730730
| {arg_type = Arg_cst _ ; arg_label = _} :: _
731731
->
732732
Location.raise_errorf
733-
~loc "Ill defined attribute @send(first argument can't be const)"
733+
~loc "Ill defined attribute %@send(first argument can't be const)"
734734
| _ :: _ ->
735735
Js_send {splice ; name; js_send_scopes = scopes ; pipe = false}
736736
end
737737
| {val_send = #bundle_source; _ }
738-
-> Location.raise_errorf ~loc "You used a FFI attribute that can't be used with @send"
738+
-> Location.raise_errorf ~loc "You used a FFI attribute that can't be used with %@send"
739739
| {val_send_pipe = Some _;
740740
(* splice = (false as splice); *)
741741
val_send = `Nm_na;
@@ -760,7 +760,7 @@ let external_desc_of_non_obj
760760
pipe = true}
761761

762762
| {val_send_pipe = Some _ ; _}
763-
-> Location.raise_errorf ~loc "conflict attributes found with [@@bs.send.pipe]"
763+
-> Location.raise_errorf ~loc "conflict attributes found with [%@%@bs.send.pipe]"
764764

765765
| {new_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name);
766766
external_module_name;
@@ -781,7 +781,7 @@ let external_desc_of_non_obj
781781
}
782782
-> Js_new {name; external_module_name; scopes}
783783
| {new_name = #bundle_source ; _ } ->
784-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with [@@new]")
784+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with %@new")
785785
| {set_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name);
786786
val_name = `Nm_na ;
787787
call_name = `Nm_na ;
@@ -801,9 +801,9 @@ let external_desc_of_non_obj
801801
->
802802
if arg_type_specs_length = 2 then
803803
Js_set { js_set_scopes = scopes ; js_set_name = name}
804-
else Location.raise_errorf ~loc "Ill defined attribute [@@set] (two args required)"
804+
else Location.raise_errorf ~loc "Ill defined attribute %@set (two args required)"
805805
| {set_name = #bundle_source; _}
806-
-> Location.raise_errorf ~loc "conflict attributes found with [@@set]"
806+
-> Location.raise_errorf ~loc "conflict attributes found with %@set"
807807
| {get_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name);
808808

809809
val_name = `Nm_na ;
@@ -825,9 +825,9 @@ let external_desc_of_non_obj
825825
if arg_type_specs_length = 1 then
826826
Js_get { js_get_name = name; js_get_scopes = scopes }
827827
else
828-
Location.raise_errorf ~loc "Ill defined attribute [@@bs.get] (only one argument)"
828+
Location.raise_errorf ~loc "Ill defined attribute %@bs.get (only one argument)"
829829
| {get_name = #bundle_source; _}
830-
-> Location.raise_errorf ~loc "Attribute found that conflicts with [@@bs.get]"
830+
-> Location.raise_errorf ~loc "Attribute found that conflicts with %@bs.get"
831831

832832
| {get_name = `Nm_na;
833833
val_name = `Nm_na ;
@@ -863,7 +863,7 @@ let handle_attributes
863863
*)
864864
if has_bs_uncurry type_annotation.ptyp_attributes then
865865
Location.raise_errorf
866-
~loc "@uncurry can not be applied to the whole definition";
866+
~loc "%@uncurry can not be applied to the whole definition";
867867
let prim_name_or_pval_name =
868868
if String.length prim_name = 0 then
869869
`Nm_val (lazy (Location.prerr_warning loc (Bs_fragile_external pval_name); pval_name))
@@ -874,7 +874,7 @@ let handle_attributes
874874
if has_bs_uncurry result_type.ptyp_attributes then
875875
Location.raise_errorf
876876
~loc:result_type.ptyp_loc
877-
"@uncurry can not be applied to tailed position";
877+
"%@uncurry can not be applied to tailed position";
878878
let no_arguments = arg_types_ty = [] in
879879
let unused_attrs, external_desc =
880880
parse_external_attributes no_arguments
@@ -892,7 +892,7 @@ let handle_attributes
892892
let arg_type = refine_arg_type ~nolabel:true obj in
893893
begin match arg_type with
894894
| Arg_cst _ ->
895-
Location.raise_errorf ~loc:obj.ptyp_loc "[@as] is not supported in @send type "
895+
Location.raise_errorf ~loc:obj.ptyp_loc "%@as is not supported in %@send type "
896896
| _ ->
897897
(* more error checking *)
898898
[{arg_label = Arg_empty; arg_type}],
@@ -910,17 +910,17 @@ let handle_attributes
910910
if i = 0 && splice then
911911
begin match arg_label with
912912
| Optional _ ->
913-
Location.raise_errorf ~loc "@@variadic expect the last type to be a non optional"
913+
Location.raise_errorf ~loc "%@variadic expect the last type to be a non optional"
914914
| Labelled _ | Nolabel
915915
->
916916
if ty.ptyp_desc = Ptyp_any then
917-
Location.raise_errorf ~loc "@@variadic expect the last type to be an array";
917+
Location.raise_errorf ~loc "%@variadic expect the last type to be an array";
918918
if spec_of_ptyp true ty <> Nothing then
919-
Location.raise_errorf ~loc "@@variadic expect the last type to be an array";
919+
Location.raise_errorf ~loc "%@variadic expect the last type to be an array";
920920
match ty.ptyp_desc with
921921
| Ptyp_constr({txt = Lident "array"; _}, [_])
922922
-> ()
923-
| _ -> Location.raise_errorf ~loc "@@variadic expect the last type to be an array";
923+
| _ -> Location.raise_errorf ~loc "%@variadic expect the last type to be an array";
924924
end ;
925925
let (arg_label : External_arg_spec.label_noname), arg_type, new_arg_types =
926926
match arg_label with
@@ -931,7 +931,7 @@ let handle_attributes
931931
(* ?x:([`x of int ] [@string]) does not make sense *)
932932
Location.raise_errorf
933933
~loc
934-
"@string does not work with optional when it has arities in label %s" s
934+
"%@string does not work with optional when it has arities in label %s" s
935935
| _ ->
936936
Arg_optional, arg_type,
937937
param_type :: arg_types end

jscomp/syntax/ast_polyvar.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ let map_row_fields_into_strings ptyp_loc
114114
let descr = if !has_bs_as then Some result else None in
115115
match has_payload, descr with
116116
| false, None ->
117-
Location.prerr_warning ptyp_loc (Bs_ffi_warning "@string is redundant here, you can safely remove it");
117+
Location.prerr_warning ptyp_loc (Bs_ffi_warning "%@string is redundant here, you can safely remove it");
118118
Nothing
119119
| false , Some descr ->
120120
External_arg_spec.Poly_var_string {descr }

jscomp/syntax/bs_builtin_ppx.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ let expr_mapper (self : mapper) (e : Parsetree.expression) =
125125
pexp_desc = Ast_uncurry_gen.to_uncurry_fn e.pexp_loc self label pat body ;
126126
pexp_attributes}
127127
| Method _ , _
128-
-> Location.raise_errorf ~loc:e.pexp_loc "@meth is not supported in function expression"
128+
-> Location.raise_errorf ~loc:e.pexp_loc "%@meth is not supported in function expression"
129129
| Meth_callback _, pexp_attributes
130130
->
131131
(** FIXME: does it make sense to have a label for [this] ? *)
@@ -151,7 +151,7 @@ let expr_mapper (self : mapper) (e : Parsetree.expression) =
151151
}
152152
| Some e ->
153153
Location.raise_errorf
154-
~loc:e.pexp_loc "`with` construct is not supported in obj ")
154+
~loc:e.pexp_loc "`with` construct is not supported in js obj ")
155155
else
156156
default_expr_mapper self e
157157
| Pexp_object {pcstr_self; pcstr_fields} ->

jscomp/syntax/bs_syntaxerr.ml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ let pp_error fmt err =
6767
-> "Uncurried function doesn't support optional arguments yet"
6868
| Expect_opt_in_bs_return_to_opt
6969
->
70-
"@return directive *_to_opt expect return type to be \n\
70+
"%@return directive *_to_opt expect return type to be \n\
7171
syntax wise `_ option` for safety"
7272

7373
| Not_supported_directive_in_bs_return
@@ -76,7 +76,7 @@ let pp_error fmt err =
7676
| Illegal_attribute ->
7777
"Illegal attributes"
7878
| Canot_infer_arity_by_syntax
79-
-> "Cannot infer the arity through the syntax, either [@uncurry n] or \n\
79+
-> "Cannot infer the arity through the syntax, either [%@uncurry n] or \n\
8080
write it in arrow syntax "
8181
| Inconsistent_arity (arity,n)
8282
-> Printf.sprintf "Inconsistent arity %d vs %d" arity n
@@ -87,7 +87,7 @@ let pp_error fmt err =
8787
->
8888
"unsupported predicates"
8989
| Conflict_bs_bs_this_bs_meth ->
90-
"@this, @bs, @meth can not be applied at the same time"
90+
"%@this, %@bs, %@meth can not be applied at the same time"
9191
| Duplicated_bs_deriving
9292
-> "duplicate bs.deriving attribute"
9393
| Conflict_attributes
@@ -96,7 +96,7 @@ let pp_error fmt err =
9696
-> "expect string literal "
9797
| Duplicated_bs_as
9898
->
99-
"duplicate @as "
99+
"duplicate %@as "
100100
| Expect_int_literal
101101
->
102102
"expect int literal "
@@ -113,20 +113,20 @@ let pp_error fmt err =
113113
"_ is not allowed in combination with external optional type"
114114
| Invalid_bs_string_type
115115
->
116-
"Not a valid type for @string"
116+
"Not a valid type for %@string"
117117
| Invalid_bs_int_type
118118
->
119-
"Not a valid type for @int"
119+
"Not a valid type for %@int"
120120
| Invalid_bs_unwrap_type
121121
->
122-
"Not a valid type for @unwrap. Type must be an inline variant (closed), and\n\
122+
"Not a valid type for %@unwrap. Type must be an inline variant (closed), and\n\
123123
each constructor must have an argument."
124124
| Conflict_ffi_attribute str
125125
->
126126
"Conflicting FFI attributes found: " ^ str
127127
| Bs_this_simple_pattern
128128
->
129-
"@this expect its pattern variable to be simple form")
129+
"%@this expect its pattern variable to be simple form")
130130

131131
type exn += Error of Location.t * error
132132

0 commit comments

Comments
 (0)