Skip to content

Commit f29732b

Browse files
committed
fix #4414, better error message for uncurried function
1 parent 1e2803c commit f29732b

File tree

5 files changed

+29
-1
lines changed

5 files changed

+29
-1
lines changed

jscomp/super_errors/super_typecore.ml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ let report_error env ppf = function
253253
fprintf ppf "it should have type@ %a@]"
254254
type_expr ty
255255
end else begin
256+
match ty with
257+
| {desc = Tconstr (Pdot (Pdot(Pident {name = "Js"},"Fn",_),_,_),_,_)} ->
258+
fprintf ppf "This expression is excpeted to have an uncurried function"
259+
| _ ->
256260
fprintf ppf "@[This expression should not be a function,@ ";
257261
fprintf ppf "the expected type is@ %a@]"
258262
type_expr ty

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62983,6 +62983,10 @@ let report_error env ppf = function
6298362983
fprintf ppf "it should have type@ %a"
6298462984
type_expr ty
6298562985
end else begin
62986+
match ty with
62987+
| {desc = Tconstr (Pdot (Pdot(Pident {name = "Js"},"Fn",_),_,_),_,_)} ->
62988+
fprintf ppf "This expression is excpeted to have an uncurried function"
62989+
| _ ->
6298662990
fprintf ppf "This expression should not be a function,@ ";
6298762991
fprintf ppf "the expected type is@ %a"
6298862992
type_expr ty
@@ -412663,6 +412667,10 @@ let report_error env ppf = function
412663412667
fprintf ppf "it should have type@ %a@]"
412664412668
type_expr ty
412665412669
end else begin
412670+
match ty with
412671+
| {desc = Tconstr (Pdot (Pdot(Pident {name = "Js"},"Fn",_),_,_),_,_)} ->
412672+
fprintf ppf "This expression is excpeted to have an uncurried function"
412673+
| _ ->
412666412674
fprintf ppf "@[This expression should not be a function,@ ";
412667412675
fprintf ppf "the expected type is@ %a@]"
412668412676
type_expr ty

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62983,6 +62983,10 @@ let report_error env ppf = function
6298362983
fprintf ppf "it should have type@ %a"
6298462984
type_expr ty
6298562985
end else begin
62986+
match ty with
62987+
| {desc = Tconstr (Pdot (Pdot(Pident {name = "Js"},"Fn",_),_,_),_,_)} ->
62988+
fprintf ppf "This expression is excpeted to have an uncurried function"
62989+
| _ ->
6298662990
fprintf ppf "This expression should not be a function,@ ";
6298762991
fprintf ppf "the expected type is@ %a"
6298862992
type_expr ty
@@ -572759,6 +572763,10 @@ let report_error env ppf = function
572759572763
fprintf ppf "it should have type@ %a@]"
572760572764
type_expr ty
572761572765
end else begin
572766+
match ty with
572767+
| {desc = Tconstr (Pdot (Pdot(Pident {name = "Js"},"Fn",_),_,_),_,_)} ->
572768+
fprintf ppf "This expression is excpeted to have an uncurried function"
572769+
| _ ->
572762572770
fprintf ppf "@[This expression should not be a function,@ ";
572763572771
fprintf ppf "the expected type is@ %a@]"
572764572772
type_expr ty

lib/4.06.1/whole_compiler.ml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348377,6 +348377,10 @@ let report_error env ppf = function
348377348377
fprintf ppf "it should have type@ %a"
348378348378
type_expr ty
348379348379
end else begin
348380+
match ty with
348381+
| {desc = Tconstr (Pdot (Pdot(Pident {name = "Js"},"Fn",_),_,_),_,_)} ->
348382+
fprintf ppf "This expression is excpeted to have an uncurried function"
348383+
| _ ->
348380348384
fprintf ppf "This expression should not be a function,@ ";
348381348385
fprintf ppf "the expected type is@ %a"
348382348386
type_expr ty
@@ -419981,6 +419985,10 @@ let report_error env ppf = function
419981419985
fprintf ppf "it should have type@ %a@]"
419982419986
type_expr ty
419983419987
end else begin
419988+
match ty with
419989+
| {desc = Tconstr (Pdot (Pdot(Pident {name = "Js"},"Fn",_),_,_),_,_)} ->
419990+
fprintf ppf "This expression is excpeted to have an uncurried function"
419991+
| _ ->
419984419992
fprintf ppf "@[This expression should not be a function,@ ";
419985419993
fprintf ppf "the expected type is@ %a@]"
419986419994
type_expr ty

ocaml

Submodule ocaml updated from c553931 to dfc68f5

0 commit comments

Comments
 (0)