Skip to content

clean up the confusing error message over uncurry label #4638

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jscomp/syntax/ast_exp_apply.ml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ let sane_property_name_check loc s =
Location.raise_errorf ~loc
"property name (%s) can not contain speical character #" s
(* match fn as *)
let view_as_app (fn : exp) s : app_pattern option =
let view_as_app (fn : exp) (s : string list) : app_pattern option =
match fn.pexp_desc with
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; _}}, args )
when Ext_list.has_string s op
Expand Down
11 changes: 7 additions & 4 deletions jscomp/syntax/bs_syntaxerr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ type error
*)
| Not_supported_directive_in_bs_return
| Expect_opt_in_bs_return_to_opt
| Label_in_uncurried_bs_attribute
| Misplaced_label_syntax
| Optional_in_uncurried_bs_attribute
| Bs_this_simple_pattern
| Bs_uncurried_arity_too_large
let pp_error fmt err =
Format.pp_print_string fmt (match err with
| Bs_uncurried_arity_too_large
-> "Uncurried function supports only up to arity 22"
| Label_in_uncurried_bs_attribute
-> "Uncurried function doesn't support labeled arguments yet"
| Misplaced_label_syntax
-> "Label syntax is not support in this position"
(*
let fn x = ((##) x ~hi) ~lo:1 ~hi:2
*)
| Optional_in_uncurried_bs_attribute
-> "Uncurried function doesn't support optional arguments yet"
| Expect_opt_in_bs_return_to_opt
Expand Down Expand Up @@ -144,7 +147,7 @@ let optional_err loc (lbl : Asttypes.arg_label) =

let err_if_label loc (lbl : Asttypes.arg_label) =
if lbl <> Nolabel then
raise (Error (loc, Label_in_uncurried_bs_attribute))
raise (Error (loc, Misplaced_label_syntax))

let err_large_arity loc arity =
if arity > 22 then
Expand Down
2 changes: 1 addition & 1 deletion jscomp/syntax/bs_syntaxerr.mli
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ type error
*)
| Not_supported_directive_in_bs_return
| Expect_opt_in_bs_return_to_opt
| Label_in_uncurried_bs_attribute
| Misplaced_label_syntax
| Optional_in_uncurried_bs_attribute
| Bs_this_simple_pattern
| Bs_uncurried_arity_too_large
Expand Down
15 changes: 9 additions & 6 deletions lib/4.06.1/unstable/js_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -400863,7 +400863,7 @@ type error
*)
| Not_supported_directive_in_bs_return
| Expect_opt_in_bs_return_to_opt
| Label_in_uncurried_bs_attribute
| Misplaced_label_syntax
| Optional_in_uncurried_bs_attribute
| Bs_this_simple_pattern
| Bs_uncurried_arity_too_large
Expand Down Expand Up @@ -400938,16 +400938,19 @@ type error
*)
| Not_supported_directive_in_bs_return
| Expect_opt_in_bs_return_to_opt
| Label_in_uncurried_bs_attribute
| Misplaced_label_syntax
| Optional_in_uncurried_bs_attribute
| Bs_this_simple_pattern
| Bs_uncurried_arity_too_large
let pp_error fmt err =
Format.pp_print_string fmt (match err with
| Bs_uncurried_arity_too_large
-> "Uncurried function supports only up to arity 22"
| Label_in_uncurried_bs_attribute
-> "Uncurried function doesn't support labeled arguments yet"
| Misplaced_label_syntax
-> "Label syntax is not support in this position"
(*
let fn x = ((##) x ~hi) ~lo:1 ~hi:2
*)
| Optional_in_uncurried_bs_attribute
-> "Uncurried function doesn't support optional arguments yet"
| Expect_opt_in_bs_return_to_opt
Expand Down Expand Up @@ -401032,7 +401035,7 @@ let optional_err loc (lbl : Asttypes.arg_label) =

let err_if_label loc (lbl : Asttypes.arg_label) =
if lbl <> Nolabel then
raise (Error (loc, Label_in_uncurried_bs_attribute))
raise (Error (loc, Misplaced_label_syntax))

let err_large_arity loc arity =
if arity > 22 then
Expand Down Expand Up @@ -407519,7 +407522,7 @@ let sane_property_name_check loc s =
Location.raise_errorf ~loc
"property name (%s) can not contain speical character #" s
(* match fn as *)
let view_as_app (fn : exp) s : app_pattern option =
let view_as_app (fn : exp) (s : string list) : app_pattern option =
match fn.pexp_desc with
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; _}}, args )
when Ext_list.has_string s op
Expand Down
15 changes: 9 additions & 6 deletions lib/4.06.1/unstable/js_refmt_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -400863,7 +400863,7 @@ type error
*)
| Not_supported_directive_in_bs_return
| Expect_opt_in_bs_return_to_opt
| Label_in_uncurried_bs_attribute
| Misplaced_label_syntax
| Optional_in_uncurried_bs_attribute
| Bs_this_simple_pattern
| Bs_uncurried_arity_too_large
Expand Down Expand Up @@ -400938,16 +400938,19 @@ type error
*)
| Not_supported_directive_in_bs_return
| Expect_opt_in_bs_return_to_opt
| Label_in_uncurried_bs_attribute
| Misplaced_label_syntax
| Optional_in_uncurried_bs_attribute
| Bs_this_simple_pattern
| Bs_uncurried_arity_too_large
let pp_error fmt err =
Format.pp_print_string fmt (match err with
| Bs_uncurried_arity_too_large
-> "Uncurried function supports only up to arity 22"
| Label_in_uncurried_bs_attribute
-> "Uncurried function doesn't support labeled arguments yet"
| Misplaced_label_syntax
-> "Label syntax is not support in this position"
(*
let fn x = ((##) x ~hi) ~lo:1 ~hi:2
*)
| Optional_in_uncurried_bs_attribute
-> "Uncurried function doesn't support optional arguments yet"
| Expect_opt_in_bs_return_to_opt
Expand Down Expand Up @@ -401032,7 +401035,7 @@ let optional_err loc (lbl : Asttypes.arg_label) =

let err_if_label loc (lbl : Asttypes.arg_label) =
if lbl <> Nolabel then
raise (Error (loc, Label_in_uncurried_bs_attribute))
raise (Error (loc, Misplaced_label_syntax))

let err_large_arity loc arity =
if arity > 22 then
Expand Down Expand Up @@ -407519,7 +407522,7 @@ let sane_property_name_check loc s =
Location.raise_errorf ~loc
"property name (%s) can not contain speical character #" s
(* match fn as *)
let view_as_app (fn : exp) s : app_pattern option =
let view_as_app (fn : exp) (s : string list) : app_pattern option =
match fn.pexp_desc with
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; _}}, args )
when Ext_list.has_string s op
Expand Down
15 changes: 9 additions & 6 deletions lib/4.06.1/unstable/native_ppx.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12056,7 +12056,7 @@ type error
*)
| Not_supported_directive_in_bs_return
| Expect_opt_in_bs_return_to_opt
| Label_in_uncurried_bs_attribute
| Misplaced_label_syntax
| Optional_in_uncurried_bs_attribute
| Bs_this_simple_pattern
| Bs_uncurried_arity_too_large
Expand Down Expand Up @@ -12131,16 +12131,19 @@ type error
*)
| Not_supported_directive_in_bs_return
| Expect_opt_in_bs_return_to_opt
| Label_in_uncurried_bs_attribute
| Misplaced_label_syntax
| Optional_in_uncurried_bs_attribute
| Bs_this_simple_pattern
| Bs_uncurried_arity_too_large
let pp_error fmt err =
Format.pp_print_string fmt (match err with
| Bs_uncurried_arity_too_large
-> "Uncurried function supports only up to arity 22"
| Label_in_uncurried_bs_attribute
-> "Uncurried function doesn't support labeled arguments yet"
| Misplaced_label_syntax
-> "Label syntax is not support in this position"
(*
let fn x = ((##) x ~hi) ~lo:1 ~hi:2
*)
| Optional_in_uncurried_bs_attribute
-> "Uncurried function doesn't support optional arguments yet"
| Expect_opt_in_bs_return_to_opt
Expand Down Expand Up @@ -12225,7 +12228,7 @@ let optional_err loc (lbl : Asttypes.arg_label) =

let err_if_label loc (lbl : Asttypes.arg_label) =
if lbl <> Nolabel then
raise (Error (loc, Label_in_uncurried_bs_attribute))
raise (Error (loc, Misplaced_label_syntax))

let err_large_arity loc arity =
if arity > 22 then
Expand Down Expand Up @@ -21456,7 +21459,7 @@ let sane_property_name_check loc s =
Location.raise_errorf ~loc
"property name (%s) can not contain speical character #" s
(* match fn as *)
let view_as_app (fn : exp) s : app_pattern option =
let view_as_app (fn : exp) (s : string list) : app_pattern option =
match fn.pexp_desc with
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; _}}, args )
when Ext_list.has_string s op
Expand Down
15 changes: 9 additions & 6 deletions lib/4.06.1/whole_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -291106,7 +291106,7 @@ type error
*)
| Not_supported_directive_in_bs_return
| Expect_opt_in_bs_return_to_opt
| Label_in_uncurried_bs_attribute
| Misplaced_label_syntax
| Optional_in_uncurried_bs_attribute
| Bs_this_simple_pattern
| Bs_uncurried_arity_too_large
Expand Down Expand Up @@ -291181,16 +291181,19 @@ type error
*)
| Not_supported_directive_in_bs_return
| Expect_opt_in_bs_return_to_opt
| Label_in_uncurried_bs_attribute
| Misplaced_label_syntax
| Optional_in_uncurried_bs_attribute
| Bs_this_simple_pattern
| Bs_uncurried_arity_too_large
let pp_error fmt err =
Format.pp_print_string fmt (match err with
| Bs_uncurried_arity_too_large
-> "Uncurried function supports only up to arity 22"
| Label_in_uncurried_bs_attribute
-> "Uncurried function doesn't support labeled arguments yet"
| Misplaced_label_syntax
-> "Label syntax is not support in this position"
(*
let fn x = ((##) x ~hi) ~lo:1 ~hi:2
*)
| Optional_in_uncurried_bs_attribute
-> "Uncurried function doesn't support optional arguments yet"
| Expect_opt_in_bs_return_to_opt
Expand Down Expand Up @@ -291275,7 +291278,7 @@ let optional_err loc (lbl : Asttypes.arg_label) =

let err_if_label loc (lbl : Asttypes.arg_label) =
if lbl <> Nolabel then
raise (Error (loc, Label_in_uncurried_bs_attribute))
raise (Error (loc, Misplaced_label_syntax))

let err_large_arity loc arity =
if arity > 22 then
Expand Down Expand Up @@ -410067,7 +410070,7 @@ let sane_property_name_check loc s =
Location.raise_errorf ~loc
"property name (%s) can not contain speical character #" s
(* match fn as *)
let view_as_app (fn : exp) s : app_pattern option =
let view_as_app (fn : exp) (s : string list) : app_pattern option =
match fn.pexp_desc with
| Pexp_apply ({pexp_desc = Pexp_ident {txt = Lident op; _}}, args )
when Ext_list.has_string s op
Expand Down