diff: polymorphism.m bug fix fix

Fergus Henderson fjh at cs.mu.oz.au
Fri Jul 25 12:36:50 AEST 1997


Hi,

compiler/polymorphism.m:
	Fix a bug in my previous bug fix: it was calling
	map__apply_to_list to apply the type-info variable map to a
	list of type variables, but not every type variable has a type
	info.

Index: polymorphism.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/polymorphism.m,v
retrieving revision 1.109
diff -u -r1.109 polymorphism.m
--- polymorphism.m	1997/07/24 08:04:31	1.109
+++ polymorphism.m	1997/07/25 02:21:00
@@ -666,13 +666,16 @@
 	set__to_sorted_list(NonLocals, NonLocalsList),
 	map__apply_to_list(NonLocalsList, VarTypes0, NonLocalsTypes),
 	term__vars_list(NonLocalsTypes, NonLocalTypeVars),
-	map__apply_to_list(NonLocalTypeVars, TypeVarMap, ExtraNonLocals),
+	solutions(lambda([TypeInfoVar::out] is nondet, (
+			list__member(Var, NonLocalTypeVars),
+			map__search(TypeVarMap, Var, TypeInfoVar)
+		)), ExtraNonLocals),
 	( ExtraNonLocals = [] ->
 		Goal = Goal0,
 		VarTypes = VarTypes0,
 		VarSet = VarSet0
 	;
-		set__list_to_set(ExtraNonLocals, NewOutsideVars),
+		set__sorted_list_to_set(ExtraNonLocals, NewOutsideVars),
 		set__union(NewOutsideVars, NonLocals, OutsideVars),
 		implicitly_quantify_goal(Goal0, VarSet0, VarTypes0,
 			OutsideVars, Goal, VarSet, VarTypes, _Warnings)

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list