Fixed missing new-line in scoping/typing error reporting.
This commit is contained in:
parent
1ef11939d2
commit
a5f89876c2
2 changed files with 30 additions and 28 deletions
|
@ -55,108 +55,110 @@ let error kind = raise (TypingError(kind))
|
|||
let message loc kind =
|
||||
begin match kind with
|
||||
| Emissing(s) ->
|
||||
Format.eprintf "%aNo equation is given for name %s.@."
|
||||
Format.eprintf "%a@\nNo equation is given for name %s.@."
|
||||
print_location loc
|
||||
s;
|
||||
| Emissingcase(s) ->
|
||||
Format.eprintf "%aCase %s not defined.@."
|
||||
Format.eprintf "%a@\nCase %s not defined.@."
|
||||
print_location loc
|
||||
s;
|
||||
| Eundefined(s) ->
|
||||
Format.eprintf "%aThe name %s is unbound.@."
|
||||
Format.eprintf "%a@\nThe name %s is unbound.@."
|
||||
print_location loc
|
||||
s;
|
||||
| Elast_undefined(s) ->
|
||||
Format.eprintf "%aThe name %s does not have a last value.@."
|
||||
Format.eprintf "%a@\nThe name %s does not have a last value.@."
|
||||
print_location loc
|
||||
s;
|
||||
| Eshould_be_last(s) ->
|
||||
Format.eprintf "%aOnly the last value of %s can be accessed.@."
|
||||
Format.eprintf "%a@\nOnly the last value of %s can be accessed.@."
|
||||
print_location loc
|
||||
s;
|
||||
| Etype_clash(actual_ty, expected_ty) ->
|
||||
Format.eprintf "%aType Clash: this expression has type %a, \n\
|
||||
Format.eprintf "%a@\nType Clash: this expression has type %a, \n\
|
||||
but is expected to have type %a.@."
|
||||
print_location loc
|
||||
Types.print_type actual_ty
|
||||
Types.print_type expected_ty
|
||||
| Earity_clash(actual_arit, expected_arit) ->
|
||||
Format.eprintf "%aType Clash: this expression expects %d arguments,\n\
|
||||
Format.eprintf
|
||||
"%a@\nType Clash: this expression expects %d arguments,\n\
|
||||
but is expected to have %d.@."
|
||||
print_location loc
|
||||
expected_arit actual_arit
|
||||
| Estatic_arity_clash(actual_arit, expected_arit) ->
|
||||
Format.eprintf "%aType Clash: this node expects %d static parameters,\n\
|
||||
Format.eprintf
|
||||
"%a@\nType Clash: this node expects %d static parameters,\n\
|
||||
but was given %d.@."
|
||||
print_location loc
|
||||
expected_arit actual_arit
|
||||
| Ealready_defined(s) ->
|
||||
Format.eprintf "%aThe name %s is already defined.@."
|
||||
Format.eprintf "%a@\nThe name %s is already defined.@."
|
||||
print_location loc
|
||||
s
|
||||
| Enon_exaustive ->
|
||||
Format.eprintf "%aSome constructors are missing in this \
|
||||
Format.eprintf "%a@\nSome constructors are missing in this \
|
||||
pattern/matching.@."
|
||||
print_location loc
|
||||
| Epartial_switch(s) ->
|
||||
Format.eprintf
|
||||
"%aThe case %s is missing.@."
|
||||
"%a@\nThe case %s is missing.@."
|
||||
print_location loc
|
||||
s
|
||||
| Etoo_many_outputs ->
|
||||
Format.eprintf
|
||||
"%aA function may only returns a basic value.@."
|
||||
"%a@\nA function may only returns a basic value.@."
|
||||
print_location loc
|
||||
| Esome_fields_are_missing ->
|
||||
Format.eprintf
|
||||
"%aSome fields are missing.@."
|
||||
"%a@\nSome fields are missing.@."
|
||||
print_location loc
|
||||
| Esubscripted_value_not_an_array ty ->
|
||||
Format.eprintf
|
||||
"%aSubscript used on a non array type : %a.@."
|
||||
"%a@\nSubscript used on a non array type : %a.@."
|
||||
print_location loc
|
||||
Types.print_type ty
|
||||
| Earray_subscript_should_be_const ->
|
||||
Format.eprintf
|
||||
"%aSubscript has to be a static value.@."
|
||||
"%a@\nSubscript has to be a static value.@."
|
||||
print_location loc
|
||||
| Eundefined_const ln ->
|
||||
Format.eprintf
|
||||
"%aThe const name '%s' is unbound.@."
|
||||
"%a@\nThe const name '%s' is unbound.@."
|
||||
print_location loc
|
||||
(fullname ln)
|
||||
| Econstraint_solve_failed c ->
|
||||
Format.eprintf
|
||||
"%aThe following constraint cannot be satisified:\n %a.@."
|
||||
"%a@\nThe following constraint cannot be satisified:\n %a.@."
|
||||
print_location loc
|
||||
print_size_constraint c
|
||||
| Etype_should_be_static ty ->
|
||||
Format.eprintf
|
||||
"%aThis type should be static : %a.@."
|
||||
"%a@\nThis type should be static : %a.@."
|
||||
print_location loc
|
||||
Types.print_type ty
|
||||
| Erecord_type_expected ty ->
|
||||
Format.eprintf
|
||||
"%aA record was expected (found %a).@."
|
||||
"%a@\nA record was expected (found %a).@."
|
||||
print_location loc
|
||||
Types.print_type ty
|
||||
| Eno_such_field (ty, f) ->
|
||||
Format.eprintf
|
||||
"%aThe record type '%a' does not have a '%s' field.@."
|
||||
"%a@\nThe record type '%a' does not have a '%s' field.@."
|
||||
print_location loc
|
||||
Types.print_type ty
|
||||
(shortname f)
|
||||
| Eempty_record ->
|
||||
Format.eprintf
|
||||
"%aThe record is empty.@."
|
||||
"%a@\nThe record is empty.@."
|
||||
print_location loc
|
||||
| Eempty_array ->
|
||||
Format.eprintf
|
||||
"%aThe array is empty.@."
|
||||
"%a@\nThe array is empty.@."
|
||||
print_location loc
|
||||
| Efoldi_bad_args ty ->
|
||||
Format.eprintf
|
||||
"%aThe function given to foldi should expect an integer \
|
||||
"%a@\nThe function given to foldi should expect an integer \
|
||||
as the last but one argument (found: %a).@."
|
||||
print_location loc
|
||||
Types.print_type ty
|
||||
|
|
|
@ -22,23 +22,23 @@ struct
|
|||
let message loc kind =
|
||||
begin match kind with
|
||||
| Evar name ->
|
||||
eprintf "%aThe value identifier %s is unbound.@."
|
||||
eprintf "%a@\nThe value identifier %s is unbound.@."
|
||||
print_location loc
|
||||
name
|
||||
| Econst_var name ->
|
||||
eprintf "%aThe const identifier %s is unbound.@."
|
||||
eprintf "%a@\nThe const identifier %s is unbound.@."
|
||||
print_location loc
|
||||
name
|
||||
| Evariable_already_defined name ->
|
||||
eprintf "%aThe variable %s is already defined.@."
|
||||
eprintf "%a@\nThe variable %s is already defined.@."
|
||||
print_location loc
|
||||
name
|
||||
| Econst_variable_already_defined name ->
|
||||
eprintf "%aThe const variable %s is already defined.@."
|
||||
eprintf "%a@\nThe const variable %s is already defined.@."
|
||||
print_location loc
|
||||
name
|
||||
| Estatic_exp_expected ->
|
||||
eprintf "%aA static expression was expected.@."
|
||||
eprintf "%a@\nA static expression was expected.@."
|
||||
print_location loc
|
||||
end;
|
||||
raise Misc.Error
|
||||
|
|
Loading…
Reference in a new issue