Skip to content

Commit

Permalink
Committing merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ncik-roberts committed Nov 13, 2023
1 parent c1ce4aa commit 7e3028e
Show file tree
Hide file tree
Showing 8 changed files with 238 additions and 129 deletions.
7 changes: 1 addition & 6 deletions src/ocaml/typing/env.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4044,12 +4044,7 @@ let report_lookup_error _loc env ppf = function
end
| Unbound_cltype lid ->
fprintf ppf "Unbound class type %a" !print_longident lid;
begin match lid with
| Lident "float" ->
Misc.did_you_mean ppf (fun () -> ["float#"])
| Lident _ | Ldot _ | Lapply _ ->
spellcheck ppf extract_cltypes env lid
end;
spellcheck ppf extract_cltypes env lid
| Unbound_instance_variable s ->
fprintf ppf "Unbound instance variable %s" s;
spellcheck_name ppf extract_instance_variables env s;
Expand Down
2 changes: 0 additions & 2 deletions src/ocaml/typing/jkind.ml
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,6 @@ let of_new_sort_var ~why =

let of_new_sort ~why = fst (of_new_sort_var ~why)

let of_sort_for_error ~why s = fresh_jkind (Sort s) ~why:(Concrete_creation why)

let of_const ~why : const -> t = function
| Any -> fresh_jkind Any ~why
| Immediate -> fresh_jkind Immediate ~why
Expand Down
5 changes: 0 additions & 5 deletions src/ocaml/typing/jkind.mli
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,6 @@ val of_new_sort_var : why:concrete_jkind_reason -> t * sort
(** Create a fresh sort variable, packed into a jkind. *)
val of_new_sort : why:concrete_jkind_reason -> t

(** There should not be a need to convert a sort to a jkind, but this is
occasionally useful for formatting error messages. Do not use in actual
type-checking. *)
val of_sort_for_error : why:concrete_jkind_reason -> sort -> t

val of_const : why:creation_reason -> const -> t

(* CR layouts v1.5: remove legacy_immediate when the old attributes mechanism
Expand Down
13 changes: 8 additions & 5 deletions src/ocaml/typing/typeclass.ml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ type error =
| Closing_self_type of class_signature
| Polymorphic_class_parameter
| Non_value_binding of string * Jkind.Violation.t
| Non_value_let_binding of string * Jkind.sort

exception Error of Location.t * Env.t * error
exception Error_forward of Location.error
Expand Down Expand Up @@ -1394,12 +1395,9 @@ and class_expr_aux cl_num val_env met_env virt self_scope scl =
(fun (loc, mode, sort) ->
Typecore.escape ~loc ~env:val_env ~reason:Other mode;
if not (Jkind.Sort.(equate sort value))
then let viol = Jkind.Violation.of_ (Not_a_subjkind(
Jkind.of_sort_for_error ~why:Let_binding sort,
Jkind.value ~why:Class_let_binding))
in
then
raise (Error(loc, met_env,
Non_value_binding (Ident.name id, viol)))
Non_value_let_binding (Ident.name id, sort)))
)
modes_and_sorts;
let path = Pident id in
Expand Down Expand Up @@ -2289,6 +2287,11 @@ let report_error env ppf = function
fprintf ppf
"@[Variables bound in a class must have layout value.@ %a@]"
(Jkind.Violation.report_with_name ~name:nm) err
| Non_value_let_binding (nm, sort) ->
fprintf ppf
"@[The types of variables bound by a 'let' in a class function@ \
must have layout value. Instead, %s's type has layout %a.@]"
nm Jkind.Sort.format sort

let report_error env ppf err =
Printtyp.wrap_printing_env ~error:true
Expand Down
1 change: 1 addition & 0 deletions src/ocaml/typing/typeclass.mli
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ type error =
| Closing_self_type of class_signature
| Polymorphic_class_parameter
| Non_value_binding of string * Jkind.Violation.t
| Non_value_let_binding of string * Jkind.sort

exception Error of Location.t * Env.t * error
exception Error_forward of Location.error
Expand Down
Loading

0 comments on commit 7e3028e

Please sign in to comment.