mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-16 14:25:56 +00:00
Estimated hours taken: 1 Fix a bug in record syntax reported by Tom Conway which caused a compiler abort if there was a field and a constructor with the same name. compiler/post_typecheck.m: Check for a matching constructor before trying to expand out a field access function. tests/valid/Mmakefile: tests/valid/record_syntax_bug.m: Test case.
21 lines
441 B
Mathematica
21 lines
441 B
Mathematica
% The compiler of 3/5/2000 aborted on this test case because it
|
|
% didn't properly handle overloading of field access functions
|
|
% and constructors.
|
|
:- module record_syntax_bug.
|
|
:- interface.
|
|
|
|
:- type foo ---> debug(string).
|
|
:- type foo2 ---> some [T] debug(T).
|
|
:- type bar ---> bar( debug :: int ).
|
|
|
|
:- func dest(foo) = int.
|
|
|
|
:- pred baz(int, bar).
|
|
:- mode baz(in, in) is semidet.
|
|
|
|
:- implementation.
|
|
|
|
dest(debug(_)) = 42.
|
|
|
|
baz(debug(X), X).
|