diff options
author | Antal Spector-Zabusky <antal.b.sz@gmail.com> | 2021-01-19 12:52:23 -0500 |
---|---|---|
committer | Antal Spector-Zabusky <antal.b.sz@gmail.com> | 2021-05-06 20:46:01 -0400 |
commit | e87be39194b4a39887abeb6d880b14443034b4f3 (patch) | |
tree | 4bb2d74a2761dcde4684f851b30660330e73127f /typing/typeclass.mli | |
parent | 14ff896d91dc071307b713eae900c382021b4bf0 (diff) | |
download | ocaml-e87be39194b4a39887abeb6d880b14443034b4f3.tar.gz |
Maintain more structural information in type-checking errors
This commit refactors the types that make up type-checking errors to
maintain more structural information. Most significantly, we split
out the errors we get from unification, moregen, and type equality in
`Ctype` into three distinct exceptions, and retain the sorts of
information we keep during unification in the other two cases as well
(no more `Unify []`). We also maintain more information in
`Includecore` about mismatches of primitives, manifests, and private
objects and variants
This commit doesn't make a lot of changes to the user-visible error
messages yet, only what's necessary to support the type changes, but
it enables a forthcoming patch where we use this improvement to
produce more informative error messages.
This commit includes existing work by Mekhrubon Tuarev, who did all
the early development. I (Antal Spector-Zabusky) came and built the
layer of types on top.
Diffstat (limited to 'typing/typeclass.mli')
-rw-r--r-- | typing/typeclass.mli | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/typing/typeclass.mli b/typing/typeclass.mli index c3503526ae..ac8eb06ec5 100644 --- a/typing/typeclass.mli +++ b/typing/typeclass.mli @@ -90,8 +90,8 @@ val type_classes : *) type error = - Unconsistent_constraint of Ctype.Unification_trace.t - | Field_type_mismatch of string * string * Ctype.Unification_trace.t + | Unconsistent_constraint of Errortrace.unification Errortrace.t + | Field_type_mismatch of string * string * Errortrace.unification Errortrace.t | Structure_expected of class_type | Cannot_apply of class_type | Apply_wrong_label of arg_label @@ -100,10 +100,10 @@ type error = | Unbound_class_2 of Longident.t | Unbound_class_type_2 of Longident.t | Abbrev_type_clash of type_expr * type_expr * type_expr - | Constructor_type_mismatch of string * Ctype.Unification_trace.t + | Constructor_type_mismatch of string * Errortrace.unification Errortrace.t | Virtual_class of bool * bool * string list * string list | Parameter_arity_mismatch of Longident.t * int * int - | Parameter_mismatch of Ctype.Unification_trace.t + | Parameter_mismatch of Errortrace.unification Errortrace.t | Bad_parameters of Ident.t * type_expr * type_expr | Class_match_failure of Ctype.class_match_failure list | Unbound_val of string @@ -111,8 +111,8 @@ type error = | Non_generalizable_class of Ident.t * Types.class_declaration | Cannot_coerce_self of type_expr | Non_collapsable_conjunction of - Ident.t * Types.class_declaration * Ctype.Unification_trace.t - | Final_self_clash of Ctype.Unification_trace.t + Ident.t * Types.class_declaration * Errortrace.unification Errortrace.t + | Final_self_clash of Errortrace.unification Errortrace.t | Mutability_mismatch of string * mutable_flag | No_overriding of string * string | Duplicate of string * string |