mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 02:43:40 +00:00
30 lines
1.0 KiB
Mathematica
30 lines
1.0 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% This is a regression test for a bug in inter-module optimization of
|
|
% field access functions which resulted in the following error message:
|
|
%
|
|
% intermod_record2.opt:005: In clause for function `intermod_record2:field/1':
|
|
% intermod_record2.opt:005: in argument 1 of clause head:
|
|
% intermod_record2.opt:005: error: wrong number of arguments (1; should be 1)
|
|
% intermod_record2.opt:005: in use of constructor `intermod_record2:record'.
|
|
%
|
|
% The problem was that the compiler expects the clauses automatically
|
|
% introduced for field access functions to only contain a call to the field
|
|
% access function which will later be expanded into unifications, The
|
|
% clauses written to `.opt' files are already expanded.
|
|
%
|
|
|
|
:- module intermod_record.
|
|
|
|
:- interface.
|
|
|
|
:- import_module intermod_record2.
|
|
|
|
:- func use_field(record) = int.
|
|
|
|
:- implementation.
|
|
|
|
use_field(R) = field(R).
|