View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0000187 | mercury | Bug | public | 2011-03-06 17:12 | 2015-10-31 21:00 | ||||||||
Reporter | colanderman | ||||||||||||
Assigned To | juliensf | ||||||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||||||
Status | confirmed | Resolution | open | ||||||||||
Product Version | |||||||||||||
Target Version | 15.11 | Fixed in Version | |||||||||||
Summary | 0000187: Strange error with disjunctive definitions returning existential typeclass instance | ||||||||||||
Description | I don't know how to describe this but with code. Compile it and observe the error. Now uncomment the last line, and comment out the two preceding (to use an equivalent definition of the function f). Recompile and it works as expected. | ||||||||||||
Tags | No tags attached. | ||||||||||||
Attached Files |
|
Notes | |
juliensf (administrator) 2013-06-28 14:55 Last edited: 2013-06-28 14:57 |
The problem here is that polymorphism transforms the multi-clause version into the following: % Clause 1. test.f(TypeClassInfo_for_foo_3, HeadVar__1_1) = HeadVar__2_2 :- ( ( HeadVar__1_1 = test.x, HeadVar__2_2 = test.a ), TypeClassInfo_for_foo_4 = typeclass_info_const(0), TypeClassInfo_for_foo_3 = TypeClassInfo_for_foo_4 ). % Clause 2 test.f(TypeClassInfo_for_foo_3, HeadVar__1_1) = HeadVar__2_2 :- ( ( HeadVar__1_1 = test.y, HeadVar__2_2 = test.b ), TypeClassInfo_for_foo_3 = TypeClassInfo_for_foo_4 ). In the second clause TypeClassInfo_for_foo_4 is free. It should presumably have been pointed at typeclass_info_const(0) as in the first clause, but that hasn't happened for some reason. (Possibly, the mapping of typeclass_infos to static data is being maintained across clauses, so it thinks that it has already introduced the unification with the constant when it processes the second clause.) (A workaround here is to re-write the predicate with a single clause -- as mentioned in the original bug report -- since polymorphism will process that in one go and the issue won't arise.) |
pbone (administrator) 2013-06-28 15:45 |
Possibly related to bug 0000271. When fixing this consider the fix for 0000271 and also retest 0000271. |
Issue History | |||
Date Modified | Username | Field | Change |
---|---|---|---|
2011-03-06 17:12 | colanderman | New Issue | |
2011-03-06 17:12 | colanderman | File Added: test.m | |
2013-06-28 14:55 | juliensf | Note Added: 0000546 | |
2013-06-28 14:56 | juliensf | Assigned To | => juliensf |
2013-06-28 14:56 | juliensf | Status | new => confirmed |
2013-06-28 14:56 | juliensf | Note Edited: 0000546 | View Revisions |
2013-06-28 14:57 | juliensf | Note Edited: 0000546 | View Revisions |
2013-06-28 15:44 | pbone | Relationship added | related to 0000271 |
2013-06-28 15:45 | pbone | Note Added: 0000548 | |
2015-10-31 21:00 | juliensf | Product Version | => 15.11 |
2015-10-31 21:00 | juliensf | Product Version | 15.11 => |
2015-10-31 21:00 | juliensf | Target Version | => 15.11 |