Skip to content

Commit

Permalink
flambda-backend: Add hint for #float (#1864)
Browse files Browse the repository at this point in the history
Add hint for #float
  • Loading branch information
ccasin authored Sep 25, 2023
1 parent ab42aac commit 64e883d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
11 changes: 11 additions & 0 deletions testsuite/tests/typing-layouts-float64/parsing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,14 @@ Line 1, characters 9-26:
Error: The type constructor float# expects 0 argument(s),
but is here applied to 2 argument(s)
|}];;

(*******************)
(* Hint for #float *)
type t = #float;;
[%%expect {|
Line 1, characters 10-15:
1 | type t = #float;;
^^^^^
Error: Unbound class type float
Hint: Did you mean float#?
|}]
7 changes: 6 additions & 1 deletion typing/env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3889,7 +3889,12 @@ let report_lookup_error _loc env ppf = function
end
| Unbound_cltype lid ->
fprintf ppf "Unbound class type %a" !print_longident lid;
spellcheck ppf extract_cltypes env lid;
begin match lid with
| Lident "float" ->
Misc.did_you_mean ppf (fun () -> ["float#"])
| Lident _ | Ldot _ | Lapply _ ->
spellcheck ppf extract_cltypes env lid
end;
| Unbound_instance_variable s ->
fprintf ppf "Unbound instance variable %s" s;
spellcheck_name ppf extract_instance_variables env s;
Expand Down

0 comments on commit 64e883d

Please sign in to comment.