Skip to content

Commit

Permalink
fix(ppx): stop printing extra @ characters (#951)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmonteiro authored Dec 4, 2023
1 parent 63ca630 commit aeb07a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 3 additions & 5 deletions ppx/ast_external_process.ml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ open Import
module External_arg_spec = Melange_ffi.External_arg_spec
module External_ffi_types = Melange_ffi.External_ffi_types

(* record pattern match complete checker*)
(* record pattern match complete checker *)

let rec variant_can_unwrap_aux (row_fields : Parsetree.row_field list) : bool =
match row_fields with
Expand Down Expand Up @@ -158,8 +158,7 @@ let refine_obj_arg_type ~(nolabel : bool) (ptyp : Parsetree.core_type) :
let result = Ast_attributes.iter_process_mel_string_or_int_as ptyp_attrs in
(* when ppx start dropping attributes
we should warn, there is a trade off whether
we should warn dropped non bs attribute or not
*)
we should warn dropped non bs attribute or not *)
Mel_ast_invariant.warn_discarded_unused_attributes ptyp_attrs;
match result with
| None -> Error.err ~loc:ptyp.ptyp_loc Invalid_underscore_type_in_external
Expand All @@ -179,8 +178,7 @@ let refine_obj_arg_type ~(nolabel : bool) (ptyp : Parsetree.core_type) :
{[
external f : hi:([ `hi | `lo ] [@string]) -> unit -> _ = "" [@@obj]
]}
The result type would be [ hi:string ]
*)
The result type would be [ hi:string ] *)
let get_opt_arg_type ~(nolabel : bool) (ptyp : Parsetree.core_type) :
External_arg_spec.attr =
if ptyp.ptyp_desc = Ptyp_any then
Expand Down
10 changes: 5 additions & 5 deletions ppx/error.ml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ let pp_error fmt err =
"`@mel.return' directive *_to_opt expects the return type to be an \
option literal type (`_ option')"
| Not_supported_directive_in_mel_return ->
"Unsupported `@mel.return' directive. Supported directives are one of:@\n\
- undefined_to_opt@\n\
- null_to_opt@\n\
- nullable / null_undefined_to_opt@\n\
"Unsupported `@mel.return' directive. Supported directives are one of:\n\
- undefined_to_opt\n\
- null_to_opt\n\
- nullable / null_undefined_to_opt\n\
- identity"
| Cannot_infer_arity_by_syntax ->
"Cannot infer arity through syntax.@\n\
"Cannot infer arity through syntax.\n\
Use either `[@mel.uncurry n]' or the full arrow type"
| Inconsistent_arity { uncurry_attribute; real } ->
Printf.sprintf
Expand Down

0 comments on commit aeb07a4

Please sign in to comment.