Skip to content

Commit c72f219

Browse files
committed
[compiler] change Field_name Ident.t to Field_name string to make error reporting more useful
1 parent fabbb4f commit c72f219

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

typing/includecore.ml

+4-4
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ type type_mismatch =
140140
| Field_type of Ident.t
141141
| Field_mutable of Ident.t
142142
| Field_arity of Ident.t
143-
| Field_names of int * Ident.t * Ident.t
143+
| Field_names of int * string * string
144144
| Field_missing of bool * Ident.t
145145
| Record_representation of bool (* true means second one is unboxed float *)
146146
| Unboxed_representation of bool (* true means second one is unboxed *)
@@ -163,7 +163,7 @@ let report_type_mismatch0 first second decl ppf err =
163163
pr "The arities for field %s differ" (Ident.name s)
164164
| Field_names (n, name1, name2) ->
165165
pr "Fields number %i have different names, %s and %s"
166-
n (Ident.name name1) (Ident.name name2)
166+
n name1 name2
167167
| Field_missing (b, s) ->
168168
pr "The field %s is only present in %s %s"
169169
(Ident.name s) (if b then second else first) decl
@@ -204,7 +204,7 @@ and compare_variants ~loc env params1 params2 n
204204
| c::_, [] -> [Field_missing (false, c.Types.cd_id)]
205205
| cd1::rem1, cd2::rem2 ->
206206
if Ident.name cd1.cd_id <> Ident.name cd2.cd_id then
207-
[Field_names (n, cd1.cd_id, cd2.cd_id)]
207+
[Field_names (n, cd1.cd_id.name, cd2.cd_id.name)]
208208
else begin
209209
Builtin_attributes.check_deprecated_inclusion
210210
~def:cd1.cd_loc
@@ -239,7 +239,7 @@ and compare_records ~loc env params1 params2 n
239239
| l::_, [] -> [Field_missing (false, l.Types.ld_id)]
240240
| ld1::rem1, ld2::rem2 ->
241241
if Ident.name ld1.ld_id <> Ident.name ld2.ld_id
242-
then [Field_names (n, ld1.ld_id, ld2.ld_id)]
242+
then [Field_names (n, ld1.ld_id.name, ld2.ld_id.name)]
243243
else if ld1.ld_mutable <> ld2.ld_mutable then [Field_mutable ld1.ld_id] else begin
244244
Builtin_attributes.check_deprecated_mutable_inclusion
245245
~def:ld1.ld_loc

typing/includecore.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ type type_mismatch =
3030
| Field_type of Ident.t
3131
| Field_mutable of Ident.t
3232
| Field_arity of Ident.t
33-
| Field_names of int * Ident.t * Ident.t
33+
| Field_names of int * string * string
3434
| Field_missing of bool * Ident.t
3535
| Record_representation of bool
3636
| Unboxed_representation of bool

0 commit comments

Comments
 (0)