Files
mercury/tests/valid/record_syntax_bug.m
Simon Taylor 20c791b2dd Fix a bug in record syntax reported by Tom Conway which caused a
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.
2000-05-04 04:33:25 +00:00

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).