mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-23 05:13:48 +00:00
Until now, if the exported part of a module has duplicate definitions
of the same field name, we have put those duplicate definitions into
the module's .int3 file, which meant that we got error messages about
those duplicate field names *from every compilation that read that
.int3 file*, as well as when generating code for the actual guilty module.
With this diff, the compiler will refuse to generate a .int3 file
containing such duplicates, so we don't get such an avalanche of repeats
of the same set of error messages.
compiler/check_parse_tree_type_defns.m:
As above.
Improve documentation.
configure.ac:
Since the new code in check_parse_tree_type_defns.m uses simplest_msgs,
require the installed compiler to support them.
Delete some compiler flags that should no longer be needed,
as well as an out-of-date comment.
tests/invalid/repeated_field_name.{m,err_exp}:
Extend this test case with more kinds of field name repeats:
repeats in other function symbols, and repeats in other types.
The error messages in the .err_exp file come from old code that
adds field names to the HLDS, NOT from the new code in
check_parse_tree_type_defns.m. However, manual invocation
of the updated compiler on the updated test case with
--make-short-interface generates the right error messages.
24 lines
402 B
Mathematica
24 lines
402 B
Mathematica
% vim: ts=4 sw=4 ft=mercury
|
|
|
|
:- module repeated_field_name.
|
|
|
|
:- interface.
|
|
|
|
:- type t
|
|
---> t1(
|
|
f1 :: int,
|
|
f2 :: int,
|
|
f2 :: int,
|
|
f2 :: int
|
|
)
|
|
; t2(
|
|
f1 :: int
|
|
).
|
|
|
|
:- type u
|
|
---> u1(
|
|
f1 :: int,
|
|
f1 :: int,
|
|
f2 :: int
|
|
).
|