[m-users.] Is this a compiler bug?
Volker Wysk
post at volker-wysk.de
Sun Nov 13 05:20:30 AEDT 2022
Hi.
The following program fails to compile:
:- module pairbug.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module pair, string.
:- pred p(pair(string, string)::out, io::di, io::uo) is det.
p("foo" - "bar", !IO).
main(!IO) :-
p(A - B, !IO). % <- line 19
The message is:
pairbug.m:006: In `main'(di, uo):
pairbug.m:006: error: determinism declaration not satisfied.
pairbug.m:006: Declared `det', inferred `semidet'.
pairbug.m:006: The reason for the difference is the following.
pairbug.m:019: In argument 1 of call to predicate `pairbug.p'/3:
pairbug.m:019: unification with `V_9' can fail.
But the following works:
main(!IO) :-
p(P, !IO),
P = A - B.
This must either be something stupid or a compiler bug...
Cheers
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/users/attachments/20221112/b375c3e1/attachment.sig>
More information about the users
mailing list