[m-rev.] for review: checked defns in parse_tree_module_src

Zoltan Somogyi zoltan.somogyi at runbox.com
Fri Oct 15 21:08:55 AEDT 2021


For review by anyone.

With this diff, there is one test case failure. abstract_type_decl.m,
current in tests/invalid, has code like this:

:- interface.
:- type foo.
:- implementation.
:- type foo.
:- type foo ---> foo(int).

Before this diff, the compiler rejected this code, with an error
saying that the second declaration conflicts with the first,
due to them being in different sections.

With this diff, we now generate only warnings for redundant
declarations in the implementation section, and we don't even
do that for redundant declarations in the interface section
(since in library modules such as map.m, we will have
a declaration of e.g. map/2 in the interface section we include
in the manual, and an actual definition in a second interface
section we do NOT include in the manual).

Since the section mismatch between the two declarations
was the only error in the test case, making it not an error
makes the test case fail by having the compiler exit
with a success exit code.

I could make the compiler generate an error for this case,
but I don't think that would be a good idea, since that would
complicate the relatively simple rule "redundant declarations
get at most a warning". This would require moving the test case
to tests/warnings. Does anyone object to this move?

Zoltan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Log.checksrc
Type: application/octet-stream
Size: 4607 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20211015/ae84e6e7/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: DIFF.checksrc
Type: application/octet-stream
Size: 187424 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20211015/ae84e6e7/attachment-0003.obj>


More information about the reviews mailing list