2024-04-19 13:13 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000359mercuryBugpublic2018-03-06 15:45
Reporterwangp 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
Product Version 
Target VersionFixed in Version 
Summary0000359: constrained polymorphic modes
DescriptionSaving test cases to fix some other time.
TagsNo tags attached.
Attached Files

-Relationships
+Relationships

-Notes

~0000793

wangp (developer)

The problem in lambda.m:
http://www.mercurylang.org/list-archives/users/2002-August/001921.html

~0000843

mark (administrator)

A workaround for this is to use an explicit pred expression. For the lambda.m example, write:

    P = (pred(Z::out(bound(1))) is det :- id(1, Z))

This will ensure that the inst variable for call to id/2 is bound in the way that is intended.

~0000966

wangp (developer)

While investigating something else, I found that modecheck_higher_order_call calls inst_expand which does not look past a top-level node of constrained_inst_vars. So this does not work, but I think there is no reason it should not work.

:- inst b == (pred(in) is semidet).

:- pred p2(pred(int)::in(I)) is semidet <= I =< b.

p2(X) :- X(42).

~0000967

wangp (developer)

The compiler crashes on create_test_unification.m:

Software Error: predicate `parse_tree.prog_mode.get_arg_insts'/4: Unexpected: defined_inst

simplify_goal_switch.create_test_unification calls inst_expand (which does not touch an inst with constrained_inst_vars at the top level) followed by get_arg_insts (which expects the inst to be expanded).
+Notes

-Issue History
Date Modified Username Field Change
2014-09-05 17:31 wangp New Issue
2014-09-05 17:31 wangp File Added: lambda.m
2014-10-09 11:44 wangp Note Added: 0000793
2015-07-15 11:37 mark Note Added: 0000843
2018-03-06 15:24 wangp File Added: ho_constrained_poly_inst.m
2018-03-06 15:31 wangp Note Added: 0000966
2018-03-06 15:41 wangp File Added: create_test_unification.m
2018-03-06 15:45 wangp Note Added: 0000967
+Issue History