2024-11-23 20:27 AEDT

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000187mercuryBugpublic2015-10-31 21:00
Reportercolanderman 
Assigned Tojuliensf 
PrioritynormalSeverityminorReproducibilityalways
StatusconfirmedResolutionopen 
Product Version 
Target Version15.11Fixed in Version 
Summary0000187: Strange error with disjunctive definitions returning existential typeclass instance
DescriptionI 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.
TagsNo tags attached.
Attached Files
  • ? file icon test.m (265 bytes) 2011-03-06 17:12

-Relationships
related to 0000271closedpbone Polymorphism related compiler crash. 
+Relationships

-Notes

~0000546

juliensf (administrator)

Last edited: 2013-06-28 14:57

View 3 revisions

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.)

~0000548

pbone (administrator)

Possibly related to bug 0000271. When fixing this consider the fix for 0000271 and also retest 0000271.
+Notes

-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
+Issue History