[m-rev.] for review: do occurs checks on the parse tree

Zoltan Somogyi zoltan.somogyi at runbox.com
Thu Oct 3 10:13:40 AEST 2019



On Wed, 2 Oct 2019 19:50:50 +1000 (AEST), Julien Fischer <jfischer at opturion.com> wrote:
> That looks fine.

Ok. Attached is the updated diff, for postcommit review by Julien.

This diff does not yet try to filter out false warnings, because we first need
to decide how that should be done. There are four possibilities for f in X = f(...X...)
that we need to consider for that:

1. It is defined as a data constructor, and not defined as an executable function.
In this case, it is clear we should generate the warning.

2. It is not a data constructor, but it is an executable function.
In this case, it is clear we should NOT generate the warning.

3. It is defined neither as a data constructor or as an executable function.
This will definitely yield an error from the type checker, so whether we generate
a warning as well does not really matter.

4 It is defined *both* as a data constructor and as an executable function.
In this case, a warning may be on point, or it may be misleading, depending
on what the typechecker eventually decides.

The question is: should we generate a warning in case 4? If yes, we can do that
by passing down the set of data constructors to superhomogeneous.m, and adding
the X on the LHS to the ancestor var map when processing X = f(...). If not, we can
do that by passing down the set of executable functions to it, and *clearing* the initial
ancestor var map when processing the ... in X = f(...) if the f is an executable function.
I see no reason to pass both the set of data constructors and the set of executable
functions; depending on how we want to handle case 4, one or the other won't be
needed.

I prefer "yes" on case 4. Any other opinions?

Zoltan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.occurs
Type: application/octet-stream
Size: 2940 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20191003/0d6d60b3/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.occurs
Type: application/octet-stream
Size: 38621 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20191003/0d6d60b3/attachment-0003.obj>


More information about the reviews mailing list