Skip to content
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
9 changes: 5 additions & 4 deletions jscomp/super_errors/super_typecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,15 @@ let report_error env ppf = function
"This simple coercion was not fully general."
"Consider using a double coercion."
| Too_many_arguments (in_function, ty) ->
(* modified *)
reset_and_mark_loops ty;
if in_function then begin
fprintf ppf "This function expects too many arguments,@ ";
fprintf ppf "it should have type@ %a"
fprintf ppf "@[This function expects too many arguments,@ ";
fprintf ppf "it should have type@ %a@]"
type_expr ty
end else begin
fprintf ppf "This expression should not be a function,@ ";
fprintf ppf "the expected type is@ %a"
fprintf ppf "@[This expression should not be a function,@ ";
fprintf ppf "the expected type is@ %a@]"
type_expr ty
end
| Abstract_wrong_label (l, ty) ->
Expand Down
10 changes: 5 additions & 5 deletions jscomp/super_errors/super_typemod.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ let fprintf = Format.fprintf
let pp_component_type_not_generalizable_pre ppf =
fprintf ppf "@[<v>\
@[@{<info>Is this a ReasonReact reducerComponent or component with retained props?@}@ \
If so, this error will disappear after:@]@,\
If so, you can fix it by doing one of these:@]@,\
@[- Defining the component's `make` function@]@,\
@[- Using the state once or annotating it with a type where it's used (e.g. render)@]@,\
@[- Doing the same for action (in e.g. reducer)@]@,\
@[- Doing the same for retained props, if any@]@,@,\
@[- Annotating the state once with a type, wherever it's used (e.g. render)@]@,\
@[- Annotating actions (in e.g. reducer)@]@,\
@[- Annotating retained props, if any@]@,@,\
@[@{<info>Here's the original error message@}@]\
@]@,"

let pp_component_type_not_generalizable_post ppf () =
fprintf ppf
"@[This happens when the type system senses there's a mutation/side-effect, in combination with a polymorphic value.@,\
"@[This happens when the type system senses there's a mutation/side-effect,@ in combination with a polymorphic value.@,\
Using or annotating that value usually solves it.@ \
More info:@ https://realworldocaml.org/v1/en/html/imperative-programming-1.html#side-effects-and-weak-polymorphism@]"

Expand Down