[m-dev.] diff for review: overload resolution for higher-order terms

Simon TAYLOR stayl at students.cs.mu.oz.au
Sun Mar 23 20:22:58 AEDT 1997


Hi Fergus,

Sorry to have OK'ed this diff before. It contains a bug that causes
the compiler to fail to compile graph.m and queue.m.

> Index: intermod.m
> ===================================================================
> @@ -511,40 +510,77 @@

...

> -		intermod_info_get_var_types(VarTypes),
> +		%
> +		% Is this a higher-order predicate or higher-order function
> +		% term?
> +		%
>  		{ Functor0 = cons(PredName, Arity) },
> +		intermod_info_get_var_types(VarTypes),
>  		{ map__lookup(VarTypes, LVar, LVarType) },
>  		{ type_is_higher_order(LVarType, PredOrFunc, PredArgTypes) }
>  	->
> -			% The unification creates a higher-order pred constant.
> -		{ get_pred_id_and_proc_id(PredName, Arity, PredOrFunc,
> -			PredArgTypes, ModuleInfo, PredId, _ProcId) },
> -		{ module_info_pred_info(ModuleInfo, PredId, PredInfo) },
> -		{ pred_info_module(PredInfo, Module) },
> -		{ unqualify_name(PredName, UnqualPredName) },
> -		{ QualifiedPredName = qualified(Module, UnqualPredName) },
> -		{ Functor = cons(QualifiedPredName, Arity) },
> -		intermod_info_add_proc(PredId, DoWrite)
> +		%
> +		% Yes, the unification creates a higher-order term.
> +		% Make sure that the predicate/function is exported.
> +		%
> +		{ map__apply_to_list(Vars, VarTypes, Types) },
> +   ****	{ list__append(PredArgTypes, Types, ArgTypes) },	****
> +		{ get_pred_id_and_proc_id(PredName, PredOrFunc,
> +			TVarSet, ArgTypes, ModuleInfo, PredId, _ProcId) },

The arguments in the call to list__append are in the wrong order. The types
of the curried arguments should come before the types of the to-be-supplied
arguments.

Simon.



More information about the developers mailing list