[m-rev.] Another compiler bug with almost the same code
Volker Wysk
post at volker-wysk.de
Thu Nov 9 04:24:58 AEDT 2023
Hi
The following, slightly modified code leads to another compiler bug (so it
seems):
:- pred with_connection(pred(int, T, io, io), T, io, io).
%:- mode with_connection(pred(in, out, di, uo) is det, out, di, uo) is
det.
:- mode with_connection(pred(in, out, di, uo) is cc_multi, out, di, uo) is
cc_multi.
with_connection(Pred, PRes, !IO) :-
Cleanup =
(pred(io.ok::out, !.IO1::di, !:IO1::uo) is cc_multi :-
!:IO1 = !.IO1),
exception.finally(
Pred(1), % Line 28
PRes,
Cleanup,
_CleanupRes,
!IO).
Even though the second mode line is commented out, it doesn't compile:
finally.m:028: In clause for predicate `with_connection'/4:
finally.m:028: in argument 1 of call to predicate `exception.finally'/6:
finally.m:028: in unification of argument
finally.m:028: and term `Pred(V_21)':
finally.m:028: type error in argument of higher-order term (with arity 1).
finally.m:028: Functor (Pred) has type
finally.m:028: some [T] (pred(int, T, io.state, io.state)),
finally.m:028: expected type was
finally.m:028: func(V_5) = V_6.
Why is the expected type a function? That must be wrong.
Cheers,
Volker
More information about the reviews
mailing list