2024-12-04 04:42 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000009mercuryBugpublic2007-10-13 22:39
Reporterjuliensf 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
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

-Relationships
+Relationships

-Notes
There are no notes attached to this issue.
+Notes

-Issue History
Date Modified Username Field Change
2007-09-28 00:13 juliensf New Issue
2007-09-28 00:13 juliensf File Added: testbug.m
2007-10-09 17:23 anonymous Note Added: 0000011
2007-10-09 17:24 anonymous Note Added: 0000012
2007-10-13 04:02 anonymous Note Added: 0000015
2007-10-13 04:02 anonymous Note Added: 0000016
2007-10-13 08:52 anonymous Note Added: 0000017
2007-10-13 13:07 anonymous Note Added: 0000018
2007-10-13 22:39 anonymous Note Added: 0000020
2007-10-23 18:37 juliensf Note Deleted: 0000011
2007-10-23 18:37 juliensf Note Deleted: 0000012
2007-10-23 18:38 juliensf Note Deleted: 0000020
2007-10-23 18:38 juliensf Note Deleted: 0000018
2007-10-23 18:38 juliensf Note Deleted: 0000017
2007-10-23 18:39 juliensf Note Deleted: 0000015
2007-10-23 18:39 juliensf Note Deleted: 0000016
+Issue History