mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-29 16:24:43 +00:00
compiler/prog_out.m:
We a program used '*' to mean integer multiplication but didn't import
int.m, we used to print a misleading error message that said
"undefined symbol `star/2'. This was because we mangled the "*"
into "star" when printing the cons_id. While this is what you want
to do when printing cons_ids in e.g. comments in generated C code,
it is not what we want when printing error messages. Fix this.
tests/invalid/multiply_star.{m,err_exp}:
Add a regression test for this problem.
tests/invalid/Mmakefile:
Enable the new test.
22 lines
427 B
Mathematica
22 lines
427 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
|
|
:- module multiply_star.
|
|
|
|
:- interface.
|
|
|
|
:- pred p(int::in, int::out) is det.
|
|
|
|
:- implementation.
|
|
|
|
% :- import_module int. % This import is missing.
|
|
|
|
p(A, Z) :-
|
|
( if A = 0 then
|
|
Z = 1
|
|
else
|
|
Z = A * 2
|
|
).
|