[m-rev.] diff: fix explicit type qualification bug
Simon Taylor
stayl at cs.mu.OZ.AU
Tue Jan 8 02:15:22 AEDT 2002
Estimated hours taken: 1
Branches: main
compiler/make_hlds.m:
Fix a bug in the handling of explicit type qualifications.
The explicit variable types map needs to be passed to
quantification so that the type qualifications apply
to any renamings of the qualified variables.
tests/hard_coded/type_qual.m:
tests/hard_coded/type_qual.exp:
Test case.
Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.394
diff -u -u -r1.394 make_hlds.m
--- compiler/make_hlds.m 5 Jan 2002 06:06:29 -0000 1.394
+++ compiler/make_hlds.m 7 Jan 2002 13:13:33 -0000
@@ -5591,15 +5591,16 @@
->
{ VarSet2 = VarSet1 },
{ Goal2 = Goal1 },
- { Info = Info0 }
+ { Info2 = Info0 }
;
{ ArgContext = head(PredOrFunc, Arity) },
insert_arg_unifications(HeadVars, Args, Context, ArgContext,
- no, Goal1, VarSet1, Goal2, VarSet2, Info1, Info)
+ no, Goal1, VarSet1, Goal2, VarSet2, Info1, Info2)
),
- { map__init(EmptyVarTypes) },
- { implicitly_quantify_clause_body(HeadVars,
- Goal2, VarSet2, EmptyVarTypes, Goal, VarSet, _, Warnings) }.
+ { VarTypes2 = Info2 ^ qual_info ^ vartypes },
+ { implicitly_quantify_clause_body(HeadVars, Goal2, VarSet2, VarTypes2,
+ Goal, VarSet, VarTypes, Warnings) },
+ { Info = Info2 ^ qual_info ^ vartypes := VarTypes }.
%-----------------------------------------------------------------------------%
Index: tests/hard_coded/type_qual.exp
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/type_qual.exp,v
retrieving revision 1.2
diff -u -u -r1.2 type_qual.exp
--- tests/hard_coded/type_qual.exp 25 Sep 2000 04:23:19 -0000 1.2
+++ tests/hard_coded/type_qual.exp 7 Jan 2002 13:23:44 -0000
@@ -13,3 +13,4 @@
[]
list:list(string)
[]
+bi-implication succeeded
Index: tests/hard_coded/type_qual.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/type_qual.m,v
retrieving revision 1.2
diff -u -u -r1.2 type_qual.m
--- tests/hard_coded/type_qual.m 25 Sep 2000 04:23:19 -0000 1.2
+++ tests/hard_coded/type_qual.m 7 Jan 2002 13:24:04 -0000
@@ -16,7 +16,8 @@
test3,
test4,
test5(yes),
- test5(no).
+ test5(no),
+ test6.
:- pred test1(io__state::di, io__state::uo) is det.
@@ -65,6 +66,21 @@
{ Y = [] `with_type` T },
io__write(type_of(Y)), nl,
io__write(Y), nl.
+
+:- pred test6(io__state::di, io__state::uo) is det.
+
+test6 -->
+ (
+ {
+ X = type_of([] `with_type` list(int))
+ <=>
+ X = type_of([1, 2, 3])
+ }
+ ->
+ io__write_string("bi-implication succeeded\n")
+ ;
+ io__write_string("bi-implication failed\n")
+ ).
empty_list = [] `with_type` list(int).
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list