[mercury-users] Mode checking bug
Peter Hawkins
hawkinsp at cs.stanford.edu
Tue Jul 4 06:06:17 AEST 2006
Hi...
The following program produces this mode error, whereas I think it
should mode check fine (compiler ROTD 2006-06-26):
test.m:022: In clause for `'__Unify__'((unique(test.lterm(ground,
test.m:022: unique(test.lterm(free, ground)))) >> bound(test.lterm
(ground,
test.m:022: bound(test.lterm(ground, ground))))), (ground >>
test.m:022: bound(test.lterm(ground, bound(test.lterm(ground,
ground))))))':
test.m:022: mode error in unification of `HeadVar__1' and
`test.lterm(V_9,
test.m:022: V_10)'.
test.m:022: Variable `HeadVar__1' has instantiatedness
test.m:022: `unique(test.lterm(ground, unique(test.lterm(free,
ground))))',
test.m:022: term `test.lterm(V_9, V_10)' has instantiatedness
`test.lterm(
test.m:022: free,
test.m:022: free
test.m:022: )'.
:- module test.
:- interface.
:- implementation.
:- type pp ---> lterm(int, pp).
:- pred foo(pp::out, pp::out, int::out) is nondet.
:- pred bar(pp::out, pp::out, int::out) is nondet.
foo(_, _, _) :- fail.
bar(P0, lterm(PH, P1), E) :-
foo(P0, lterm(PH, P1), E),
foo(P0, lterm(PH, lterm(_, P1)), E).
But if I replace the clause for bar with the following equivalent
clause, the code mode checks fine.
bar(P0, lterm(PH, P1), E) :-
foo(P0, lterm(PH, P1), E),
foo(P0, Temp, E),
Temp = lterm(PH, lterm(_, P1)).
Please fix?
Cheers,
Peter
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list