X-Git-Url: https://git.xandkar.net/?p=tiger.ml.git;a=blobdiff_plain;f=compiler%2Fsrc%2Flib%2Ftiger%2Ftiger_error.ml;h=e8af9eb56957d3ac506f6b4fbc16dcb8be311127;hp=782f138591aa0f726afb250bdf603045959bb47f;hb=161a300dddce2df54b21863ae94e2dda281906fd;hpb=523e2b063b9ba20329af61e18dc9a5ccbaca06a0 diff --git a/compiler/src/lib/tiger/tiger_error.ml b/compiler/src/lib/tiger/tiger_error.ml index 782f138..e8af9eb 100644 --- a/compiler/src/lib/tiger/tiger_error.ml +++ b/compiler/src/lib/tiger/tiger_error.ml @@ -11,6 +11,7 @@ type t = | Id_not_a_function of {id : Sym.t; pos : Pos.t} | No_such_field_in_record of {field : Sym.t; record : Typ.t; pos : Pos.t} | Exp_not_a_record of {ty : Typ.t; pos : Pos.t} + | Exp_not_an_array of {ty : Typ.t; pos : Pos.t} | Wrong_type of { expected : Typ.t ; given : Typ.t @@ -82,7 +83,11 @@ let to_string = s "No field %S in record %S in %s" (Sym.to_string field) (Typ.to_string record) (Pos.to_string pos) | Exp_not_a_record {ty; pos} -> - s ( "This expression has type %S, it is not a record, it cannot be" + s ( "The expression of type %S is not a record, it cannot be" + ^^"accessed in %s") + (Typ.to_string ty) (Pos.to_string pos) + | Exp_not_an_array {ty; pos} -> + s ( "The expression of type %S is not an array, it cannot be" ^^"accessed in %s") (Typ.to_string ty) (Pos.to_string pos) | Wrong_type {expected; given; pos} -> @@ -144,6 +149,7 @@ let is_unknown_id t = | Id_not_a_function _ | No_such_field_in_record _ | Exp_not_a_record _ + | Exp_not_an_array _ | Wrong_type _ | Wrong_type_of_expression_in_var_dec _ | Wrong_type_used_as_record _