diff --git a/jscomp/super_errors/super_typecore.ml b/jscomp/super_errors/super_typecore.ml index 3a761d826e..28f5dfbf93 100644 --- a/jscomp/super_errors/super_typecore.ml +++ b/jscomp/super_errors/super_typecore.ml @@ -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) -> diff --git a/jscomp/super_errors/super_typemod.ml b/jscomp/super_errors/super_typemod.ml index 48ac2d3d82..38a3eadc0a 100644 --- a/jscomp/super_errors/super_typemod.ml +++ b/jscomp/super_errors/super_typemod.ml @@ -6,17 +6,17 @@ let fprintf = Format.fprintf let pp_component_type_not_generalizable_pre ppf = fprintf ppf "@[\ @[@{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@]@,@,\ @[@{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@]"