[m-rev.] for review: bug fix in existential constraints

Julien Fischer juliensf at cs.mu.OZ.AU
Fri Apr 15 11:18:57 AEST 2005


On Thu, 14 Apr 2005, Mark Brown wrote:

> Estimated hours taken: 2
> Branches: main, release-0.12
>
> Only allow existential constraints to constrain existentially quantified
> type variables.  Likewise only allow universal constraints to constrain
> universally quantified type variables.
>
> We previously didn't check these conditions, and in fact the reference
> manual allowed otherwise.  However, the implementation did not support
> existential constraints on universally quantified type variables, and
> will not do so for the foreseeable future.  The implementation does support
> universal constraints on existentially quantified variables, however these
> are not useful since no caller will ever be able to satisfy the constraints.
>
> compiler/check_typeclass.m:
> 	Check these conditions as part of typeclass checking.
>
> 	Also return a bool from the recently added check for concrete
> 	instances, indicating whether errors were found or not.
>
The check for concrete instances hasn't yet been added to the release
branch.

> compiler/error_util.m:
> compiler/hlds_error_util.m:
> 	Add a couple of utility functions for constructing error messages.
>
> compiler/mercury_compile.m:
> 	Stop compilation after checking typeclasses if errors were encountered.
> 	If the above conditions are not met then typechecking may abort.
>
> doc/reference_manual.texi:
> 	Document the condition on typeclass constraints.
>
> tests/invalid/Mmakefile:
> tests/invalid/quant_constraint_1.err_exp:
> tests/invalid/quant_constraint_1.m:
> tests/invalid/quant_constraint_2.err_exp:
> tests/invalid/quant_constraint_2.m:
> 	Test cases for the new error messages.
>

...

> Index: compiler/hlds_error_util.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/hlds_error_util.m,v
> retrieving revision 1.9
> diff -u -r1.9 hlds_error_util.m
> --- compiler/hlds_error_util.m	22 Mar 2005 06:39:59 -0000	1.9
> +++ compiler/hlds_error_util.m	14 Apr 2005 06:03:15 -0000
> @@ -35,6 +35,9 @@
>  :- func describe_one_pred_name(module_info, should_module_qualify, pred_id)
>  	= list(format_component).
>
> +:- func describe_one_pred_info_name(should_module_qualify, pred_info)
> +	= list(format_component).
> +
>  :- func describe_one_pred_name_mode(module_info, should_module_qualify,
>  	pred_id, inst_varset, list(mode)) = list(format_component).
>
> @@ -79,8 +82,11 @@
>
>  describe_one_pred_name(Module, ShouldModuleQualify, PredId) = Pieces :-
>  	module_info_pred_info(Module, PredId, PredInfo),
> -	ModuleName = pred_info_module(PredInfo),
> +	Pieces = describe_one_pred_info_name(ShouldModuleQualify, PredInfo).
> +
> +describe_one_pred_info_name(ShouldModuleQualify, PredInfo) = Pieces :-
>  	PredName = pred_info_name(PredInfo),
> +	ModuleName = pred_info_module(PredInfo),
>  	Arity = pred_info_orig_arity(PredInfo),
>  	PredOrFunc = pred_info_is_pred_or_func(PredInfo),
>  	PredOrFuncStr = pred_or_func_to_string(PredOrFunc),

Although it's nothing to do directly with this diff, it looks like
the procedures in hlds_error_util haven't been kept in sync with
the ones in error_util.  In particular, error_util, now prints
out sym_name_and_arities as:

	`SymName'/Arity

whereas in hlds_error_util, they are printed out as:

	`SymName/Arity'

(This only affects the main branch since the change that caused
this was never committed to the release branch).

That looks fine otherwise.

Julien.





--------------------------------------------------------------------------
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