undef mode diff

David Glen JEFFERY dgj at cs.mu.oz.au
Fri May 23 15:22:09 AEST 1997


> Hi DJ,
> 
> Could you please review this.
> 
> Simon
> 
> Estimated hours taken: 1
> 
> Fix bugs where undefined modes were causing map__lookup failures.
> 
> compiler/mode_util.m
> 	Add mode_get_insts_semidet, which fails instead of aborting
> 	if the mode is undefined.
> 
> compiler/make_hlds.m
> 	Use mode_get_insts_semidet instead of mode_get_insts when 
> 	matching pragma c_code modes.
> 
> compiler/mercury_compile.m
> compiler/typecheck.m
> 	Pass through whether there were undefined modes into typecheck.m.
> 	Only attempt to propagate type information into modes if there
> 	were no undefined mode errors.
> 
> tests/invalid/Mmake
> tests/invalid/undef_mode.m
> tests/invalid/undef_mode.err_exp
> 	Add a test case.	

This is fine, but I have one minor comment. I think that the code would be
more readable if you changed the order of the arguments to preds in a couple
of places. I'll point them out. Change them if you agree, ignore if you don't.
This is really just a matter of taste, I guess.

Feel free to commit with or without my suggestions.

> +:- pred typecheck(bool, module_info, module_info, bool, io__state, io__state).
> +typecheck(ModeError, Module0, Module, FoundError) -->

I think that either
	typecheck(Module0, Module, ModeError, FoundError) 
	or
	typecheck(Module0, ModeError, Module, FoundError) 
	
would be more readable, since Module0 is the first argument and it's the most
important thing being passed. The downside is that, with the first alternative
I gave, the mode becomes (in, out, in, out), while for the second one the mode
is (in, in, out, out), but then Module0 and Module aren't next to each other.

For the following, I would make the same comment as for typecheck:
> +:- pred check_pred_types(bool, module_info, module_info, bool,
> +		io__state, io__state).
> +check_pred_types(ModeError, Module0, Module, FoundError) -->

> +:- pred typecheck_to_fixpoint(list(pred_id), bool, module_info, 
> +		module_info, bool, io__state, io__state).
> +typecheck_to_fixpoint(PredIds, ModeError, Module0, Module, FoundError) -->

> +:- pred typecheck_pred_types_2(list(pred_id), bool, module_info, module_info,
>  	bool, bool, bool, bool, io__state, io__state).
> +typecheck_pred_types_2([PredId | PredIds], ModeError, 
>  		ModuleInfo0, ModuleInfo, Error0, Error, Changed0, Changed) -->
>  


love and cuddles,
dgj
-- 



This .sig deliberately left blank






More information about the developers mailing list