Mercury Bugs - mercury
View Issue Details
0000009mercuryBugpublic2007-09-28 00:132007-10-13 22:39
Reporterjuliensf 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000009: spurious error message when testing equivalence of equal things
DescriptionFrom bojar@csse.unimelb.edu.au Fri May 18 19:03:54 2007
Date: Fri, 18 May 2007 19:06:43 +1000
From: Ondrej Bojar <bojar@csse.unimelb.edu.au>
To: mercury-bugs@csse.unimelb.edu.au
Subject: spurious error message when testing equivalence of equal things

Hi.

When compiling this code:

:- module testbug.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.

:- import_module list, int.

main(!IO) :-
   A = [1,2,3],
   B = [1,2,3],
   (
   if A = B
   % if same(A, B) % use this to compile seamlessly
   then io.write_string("yes\n", !IO)
   else io.write_string("no\n", !IO)
   ).

:- pred same(T::in, T::in) is semidet.
same(A, B) :- A = B.


The compiler emits a lengthy message:

testbug.m:013: In clause for `'__Unify__'(in, (unique(list.'[|]'(unique(1),
testbug.m:013: unique(list.'[|]'(unique(2), unique(list.'[|]'(unique(3),
testbug.m:013: unique((list.[])))))))) >> unique(list.'[|]'(unique(1),
testbug.m:013: unique(list.'[|]'(unique(2), unique(list.'[|]'(unique(3),
testbug.m:013: unique((list.[]))))))))), (unique(list.'[|]'(unique(1),
testbug.m:013: unique(list.'[|]'(unique(2), unique(list.'[|]'(unique(3),
testbug.m:013: unique((list.[])))))))) >> unique(list.'[|]'(unique(1),
testbug.m:013: unique(list.'[|]'(unique(2), unique(list.'[|]'(unique(3),
testbug.m:013: unique((list.[]))))))))))':
testbug.m:013: mode error: argument 2 did not get sufficiently instantiated.
testbug.m:013: Final instantiatedness of `HeadVar__1' was
testbug.m:013: `unique(list.'[|]'(bound(1), bound(list.'[|]'(bound(2),
testbug.m:013: bound(list.'[|]'(bound(3), bound((list.[]))))))))',
testbug.m:013: expected final instantiatedness was
testbug.m:013: `unique(list.'[|]'(unique(1), unique(list.'[|]'(unique(2),
testbug.m:013: unique(list.'[|]'(unique(3), unique((list.[]))))))))'.
testbug.m:016: Warning: the condition of this if-then-else cannot fail.


The code seamlessly compiles if I test for the equivalence using an extra
predicate call to same/2.

The issue does not arise with primitive types, e.g. A=1, B=1.

Thanks, O.


--
Ondrej Bojar (mailto:obo@cuni.cz / bojar@ufal.mff.cuni.cz)
http://www.cuni.cz/~obo
TagsNo tags attached.
Attached Files? testbug.m (397) 2007-09-28 00:13
https://bugs.mercurylang.org/file_download.php?file_id=6&type=bug

There are no notes attached to this issue.

Issue History
2007-09-28 00:13juliensfNew Issue
2007-09-28 00:13juliensfFile Added: testbug.m
2007-10-09 17:23anonymousNote Added: 0000011
2007-10-09 17:24anonymousNote Added: 0000012
2007-10-13 04:02anonymousNote Added: 0000015
2007-10-13 04:02anonymousNote Added: 0000016
2007-10-13 08:52anonymousNote Added: 0000017
2007-10-13 13:07anonymousNote Added: 0000018
2007-10-13 22:39anonymousNote Added: 0000020
2007-10-23 18:37juliensfNote Deleted: 0000011
2007-10-23 18:37juliensfNote Deleted: 0000012
2007-10-23 18:38juliensfNote Deleted: 0000020
2007-10-23 18:38juliensfNote Deleted: 0000018
2007-10-23 18:38juliensfNote Deleted: 0000017
2007-10-23 18:39juliensfNote Deleted: 0000015
2007-10-23 18:39juliensfNote Deleted: 0000016