[m-dev.] Extra HLDS pass..

Robert Ernst Johann JESCHOFNIK rejj at students.cs.mu.oz.au
Wed Mar 1 18:22:18 AEDT 2000


Hello.


For the last while, I have been working on a change to delay the expansion
of equivalence types until they are actually used - previously they were
expanded away before the parse tree is converted to HLDS. The major
benifit of this delay is that meaningful error messages with respect to
eqv_types can be generated, eg:

e3.m:021: In clause for predicate `e3:do_stuff/0':
e3.m:021:   in argument 1 of call to predicate `do_stuff3/2':
e3.m:021:   type error: variable `Map1' has type `(map:map(int, string))',
e3.m:021:   expected type was `(map:map(string, int))'.

instead of:

e3.m:021: In clause for predicate `e3:do_stuff/0':
e3.m:021:   in argument 1 of call to predicate `do_stuff3/2':
e3.m:021:   type error: variable `Map1' has type `(tree234:tree234(int, string))',
e3.m:021:   expected type was `(tree234:tree234(string, int))'.


However, I have presently broken code generation slightly, since in
several places whilst looking up constructors for types the previous
assumption that eqv_types have been expanded is now invalid. I have gone
through in a few places I have found and added the call to expand the
particular type, but every time I do and rerun the tests, I find yet
another place that needs this to be done...

So, I was wondering if anyone has any objections to me adding another pass
over the HLDS (somewhere before code generation, as long as it is a point
after which it is known that no more error messages can be produced) that
expands all the eqv's away. This would make code gen non-broken (always a
bonus), and perhaps be a bit better performance wise as well.


Can anyone see anything wrong with doing that?



Rob

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list