[m-rev.] for post-commit review: better error messages for arg type errors
Zoltan Somogyi
zoltan.somogyi at runbox.com
Wed Dec 31 16:56:17 AEDT 2014
On Wed, 31 Dec 2014 13:02:35 +1100, Paul Bone <paul at bone.id.au> wrote:
> This is a useful change.
I thought so; that's why I made it :-)
> > + find_mismatched_args(1, ArgExpTypes, TypeAssigns,
> > + [], RevSubsumesMismatches, [], RevNoSubsumeMismatches),
> > + % RevSubsumesMismatches will contain errors where the actual type
> > + % is e.g. list(T), while the expected type is list(some_actual_type).
> > + % Since the argument may be just list(T) because it is [],
> > + % we don't mention these arguments (which are likely to be red
> > + % herrings, i.e. not the actual cause of the problem) unless
> > + % there are no arguments whose possible the actual types do not
> > + % include one that subsumes the expected type.
>
> "whose possible the actual" I don't know what you mean.
I meant "whose possible actual types". Will fix.
(Note that in the presence of type errors, we don't know what the type
of a variable IS; we only know what it MAY BE.
> > +identical_types(Type1, Type2) :-
> > + map.init(TypeSubst0),
> > + type_unify(Type1, Type2, [], TypeSubst0, TypeSubst),
> > + TypeSubst = TypeSubst0.
> > +
> > %-----------------------------------------------------------------------------%
> Should this be in the other file with subsumes_type?
No, it is only used in this module.
Zoltan.
More information about the reviews
mailing list