mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-30 00:34:40 +00:00
compiler/typecheck_errors.m:
Extend the error message with information about the need for suffixes
on integral types other than "int"
- for type errors in X = f unifications, if is an integer constant without
a suffix but X's type is an integral type that requires a suffix
(i.e. any unsigned or sized integer type); and
- for type errors involving a variable is X which was unified somewhere
in the current procedure with is an integer constant without a suffix,
but where X's expected type is an integral type that requires a suffix
(i.e. any unsigned or sized integer type).
Delete an unneeded suffix on some variable names.
compiler/typecheck.m:
If a variable is unified with an integer constant without a suffix,
record this fact.
Conform to the changes in typecheck_errors.m.
compiler/typecheck_info.m:
Extend the typecheck_info structure with a slot for recording
which variables have been unified with an integer constant
without a suffix.
Put constant fields next to each other.
tests/invalid/integral_constant_no_suffix.{m,err_exp}:
A test case for the new functionality.
tests/invalid/Mmakefile:
Enable the new test case.
25 lines
559 B
Mathematica
25 lines
559 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module integral_constant_no_suffix.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
main(!IO) :-
|
|
N = 6,
|
|
( if life_universe_everything(N) then
|
|
io.write_line("yes", !IO)
|
|
else
|
|
io.write_line("no", !IO)
|
|
).
|
|
|
|
:- pred life_universe_everything(uint8::in) is semidet.
|
|
|
|
life_universe_everything(42).
|