Skip to content

Commit d5f73de

Browse files
committed
labelled to optional arg
1 parent a471795 commit d5f73de

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

compiler/ml/error_message_utils.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,12 @@ let print_extra_type_clash_help ~extract_concrete_typedecl ~env loc ppf
627627
| ( Some (FunctionArgument {optional = true}),
628628
Some ({desc = Tconstr (p, _, _)}, _) )
629629
when Path.same Predef.path_option p ->
630-
(* TODO(actions) Prepend with `?` *)
630+
Cmt_utils.add_possible_action
631+
{
632+
loc;
633+
action = RewriteArgType {to_type = `Optional};
634+
description = "Make argument optional";
635+
};
631636
fprintf ppf
632637
"@,\
633638
@,\
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
let myFunction = (~name: option<string>=?) => {
2+
ignore(name)
3+
}
4+
let name = Some("John")
5+
myFunction(~name?)
6+
7+
/* === AVAILABLE ACTIONS:
8+
- RewriteArgType(Optional) - Make argument optional
9+
*/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let myFunction = (~name: option<string>=?) => {
2+
ignore(name)
3+
}
4+
let name = Some("John")
5+
myFunction(~name)

0 commit comments

Comments
 (0)