[m-dev.] for review: fix existential types bug

Simon Taylor stayl at cs.mu.OZ.AU
Mon Oct 25 15:34:57 AEST 1999


> > implicitly_quantify_goal is only called from
> > polymorphism__fixup_quantification if the predicate being
> > processed has type variables in the argument types.
> > This does not check whether called predicates, functions
> > or constructors have type variables in their argument types.
> 
> That used to be the case a while back, but since my changes
> to add existential types, it should not be true now.
> The comment on polymorphism__fixup_quantification says
> 
> % If the pred we are processing is a polymorphic predicate,
> % or contains polymorphically-typed goals, ...
>   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> and the code checks whether the type_info_map in the poly_info
> is empty.  If there are any polymorphically typed variables
> in the body of the predicate, then the type_info_map should
> be non-empty.

For that test case there aren't any:

:- pred construct_exist_cons(exist_cons::out) is det.
:- pred construct_exist_cons_2(exist_cons::out) is det.

construct_exist_cons(ExistCons : exist_cons) :-
        A = 1 : int,
	X = 'b' : char,
	C = 2 : int,
	ExistCons = 'new exist_cons'(A, X, C).

The type-info added for the second field of the construction
has type `type_info(char)'.

> > > Shouldn't that last occurrence of `GoalInfo0' be `GoalInfo'?
> > 
> > No, because the extra type-infos are local to that conjunction.
> 
> Are you sure?
 
> After polymorphism this will be
> 
> 	p(Flag, U) -->
> 		(if { Flag = yes, U = foo(TypeInfo, X) } then
> 			io__print(TypeInfo, X)
> 		else
> 			[]
> 		).
> 
> and the scope of TypeInfo is not local to the conjunction.
 
Ok, I'll fix that.

Simon.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list