[m-rev.] Test fixes post state variable transformation

Ralph Becket rafe at cs.mu.OZ.AU
Wed Jul 31 16:37:01 AEST 2002


Estimated hours taken: 6
Branches: main

Mostly minor fixes to make test cases pass after the state variable
transformation was introduced.

compiler/make_hlds.m:
	Reversed previous changes that accidentally undid prior work.
	Added state variable transformation to previously missed aditi cases.

tests/invalid/Mmakefile:
	Removed entry for state_vars_test5.m

tests/invalid/state_vars_test3.m:
tests/invalid/state_vars_test3.err_exp:
	Moved this test to tests/warning as state_vars_test.

tests/invalid/state_vars_test4.m:
tests/invalid/state_vars_test4.err_exp:
tests/invalid/state_vars_test5.m:
tests/invalid/state_vars_test5.err_exp:
	Renamed 4->3 and 5->4.

tests/invalid/aditi_update_errors.err_exp:
	The state variable transformation considers conjuncts in reverse
	order w.r.t. before, changing the expected order of these error
	messages.

tests/invalid/overloading.err_exp:
tests/invalid/record_syntax_errors.err_exp:
	Some variable numbers changed after introduction of the state
	variable transformation.

tests/warnings/Mmakefile:
tests/warnings/state_vars_test.m:
tests/warnings/state_vars_test.exp:
	This was tests/invalid/state_vars_test3.{m,exp}.

Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.422
diff -u -r1.422 make_hlds.m
--- compiler/make_hlds.m	30 Jul 2002 13:26:48 -0000	1.422
+++ compiler/make_hlds.m	31 Jul 2002 00:29:37 -0000
@@ -6047,16 +6047,17 @@
 
 transform_goal_2(call(Name, Args0, Purity), Context, VarSet0, Subst, Goal,
 		VarSet, Info0, Info, SInfo0, SInfo) -->
-	{ prepare_for_call(SInfo0, SInfo1) },
 	{ Args1 = expand_bang_state_var_args(Args0) },
 	( 
 		{ Name = unqualified("\\=") },
 		{ Args1 = [LHS, RHS] }
 	->
+		{ prepare_for_call(SInfo0, SInfo1) },
 			% `LHS \= RHS' is defined as `not (LHS = RHS)'
 		transform_goal_2(not(unify(LHS, RHS, Purity) - Context),
 			Context, VarSet0, Subst, Goal, VarSetX, Info0, Info,
-			SInfo1, SInfoX)
+			SInfo1, SInfoX),
+		{ finish_call(VarSetX, VarSet, SInfoX, SInfo) }
 	;
 		% check for a DCG field access goal:
 		% get:  Field =^ field
@@ -6066,9 +6067,11 @@
 		; { Operator = ":=" }
 		)
 	->
+		{ prepare_for_call(SInfo0, SInfo1) },
 		{ term__apply_substitution_to_list(Args1, Subst, Args2) },
 		transform_dcg_record_syntax(Operator, Args2, Context,
-			VarSet0, Goal, VarSetX, Info0, Info, SInfo1, SInfoX)
+			VarSet0, Goal, VarSetX, Info0, Info, SInfo1, SInfoX),
+		{ finish_call(VarSetX, VarSet, SInfoX, SInfo) }
 	;
 		% check for an Aditi builtin
 		{ Purity = pure },
@@ -6086,8 +6089,9 @@
 	->
 		{ term__apply_substitution_to_list(Args1, Subst, Args2) },
 		transform_aditi_builtin(Name1, Args2, Context, VarSet0,
-			Goal, VarSetX, Info0, Info, SInfo1, SInfoX)
+			Goal, VarSet, Info0, Info, SInfo0, SInfo)
 	;
+		{ prepare_for_call(SInfo0, SInfo1) },
 		{ term__apply_substitution_to_list(Args1, Subst, Args) },
 		{ make_fresh_arg_vars(Args, VarSet0, HeadVars, VarSet1) },
 		{ list__length(Args, Arity) },
@@ -6146,9 +6150,9 @@
 			Info0, Info1) },
 		insert_arg_unifications(HeadVars, Args, Context, call(CallId),
 			Goal0, VarSet1, Goal, VarSetX, Info1, Info,
-			SInfo1, SInfoX)
-	),
-	{ finish_call(VarSetX, VarSet, SInfoX, SInfo) }.
+			SInfo1, SInfoX),
+		{ finish_call(VarSetX, VarSet, SInfoX, SInfo) }
+	).
 
 transform_goal_2(unify(A0, B0, Purity), Context, VarSet0, Subst, Goal, VarSet,
 		Info0, Info, SInfo0, SInfo) -->
@@ -6448,7 +6452,7 @@
 	{ ArgContext = functor(Functor, MainContext, SubContext0) },
 	{ goal_info_init(Context, GoalInfo) },
 	{ conj_list_to_goal(Goals1, GoalInfo, Conj0) },
-	append_arg_unifications(FieldArgVars, FieldArgs, Context, ArgContext,
+	insert_arg_unifications(FieldArgVars, FieldArgs, Context, ArgContext,
 		Conj0, VarSet4, Conj, VarSet, Info3, Info, SInfo1, SInfo),
 	{ goal_to_conj_list(Conj, Goals) }.
 
@@ -6565,7 +6569,7 @@
 	{ ArgContext = functor(Functor, MainContext, SubContext0) },
 	{ goal_info_init(Context, GoalInfo) },
 	{ conj_list_to_goal(Goals2, GoalInfo, Conj0) },
-	append_arg_unifications(FieldArgVars, FieldArgs, Context, ArgContext,
+	insert_arg_unifications(FieldArgVars, FieldArgs, Context, ArgContext,
 		Conj0, VarSet3, Conj, VarSet, Info2, Info, SInfo1, SInfo),
 	{ goal_to_conj_list(Conj, Goals) }.
 
@@ -6853,13 +6857,25 @@
 		{ make_fresh_arg_vars(HeadArgs1, VarSet0, HeadArgs, VarSet1) },
 		{ term__coerce(GoalTerm1, GoalTerm) },
 		{ parse_goal(GoalTerm, VarSet1, ParsedGoal, VarSet2) },
-		{ map__init(Substitution) },
-		transform_goal(ParsedGoal, VarSet2, Substitution,
-			PredGoal0, VarSet3, Info0, Info1, SInfo0, SInfo1),
+
+		{ prepare_for_lambda(SInfo0, SInfo1) },
+
+		{ hlds_goal__true_goal(PredHead0) },
 		{ ArgContext = head(PredOrFunc, PredArity) },
 		insert_arg_unifications(HeadArgs, HeadArgs1, Context,
-			ArgContext, PredGoal0, VarSet3, PredGoal1, VarSet4,
-			Info1, Info2, SInfo1, SInfo2), 
+			ArgContext, PredHead0, VarSet2, PredHead, VarSet3,
+			Info0, Info1, SInfo1, SInfo2), 
+
+		{ prepare_for_body(FinalSVarMap, VarSet3, VarSet4,
+			SInfo2, SInfo3) },
+
+		{ map__init(Substitution) },
+		transform_goal(ParsedGoal, VarSet4, Substitution,
+			PredBody, VarSet5, Info1, Info2, SInfo3, SInfo4),
+
+		{ finish_head_and_body(Context, FinalSVarMap,
+			PredHead, PredBody, PredGoal0, SInfo4) },
+
 		% Quantification will reduce this down to
 		% the proper set of nonlocal arguments.
 		{ goal_util__goal_vars(PredGoal, LambdaGoalVars0) }, 
@@ -6869,7 +6885,7 @@
 		{ aditi_delete_insert_delete_modify_goal_info(InsertDelMod,
 			PredOrFunc, SymName, PredArity, HeadArgs,
 			LambdaPredOrFunc, EvalMethod, LambdaModes,
-			Detism, PredGoal1, PredGoal) },
+			Detism, PredGoal0, PredGoal) },
 		{ ModifiedCallId = PredOrFunc - SymName/PredArity },
 
 		{ invalid_pred_id(PredId) },
@@ -6879,7 +6895,7 @@
 			call(generic_call(
 				aditi_builtin(Builtin, ModifiedCallId)),
 			1) }, 
-		{ varset__new_var(VarSet4, LambdaVar, VarSet5) },
+		{ varset__new_var(VarSet5, LambdaVar, VarSet6) },
 
 		% Tell purity.m to change the mode of the `aditi__state'
 		% arguments of the closure to `unused', to make sure
@@ -6900,9 +6916,9 @@
 			Info2, Info3) },
 
 		{ make_fresh_arg_var(AditiState0Term, AditiState0Var, [],
-			VarSet5, VarSet6) },
-		{ make_fresh_arg_var(AditiStateTerm, AditiStateVar, [],
 			VarSet6, VarSet7) },
+		{ make_fresh_arg_var(AditiStateTerm, AditiStateVar, [],
+			VarSet7, VarSet8) },
 		{ AllArgs = [LambdaVar, AditiState0Var, AditiStateVar] },
 		
 		% post_typecheck.m will fill this in.
@@ -6930,7 +6946,7 @@
 			[term__variable(LambdaVar), AditiState0Term,
 				AditiStateTerm],
 			Context, CallId, UpdateConj,
-			VarSet7, UpdateGoal, VarSet, Info4, Info, SInfo2, SInfo)
+			VarSet8, UpdateGoal, VarSet, Info4, Info, SInfo4, SInfo)
 	;
 		%
 		% Second syntax -
@@ -7705,7 +7721,7 @@
 			SInfo1, SInfo2),
 
 		{ ArgContext = functor(Functor, MainContext, SubContext) },
-		append_arg_unifications([InputTermVar], [InputTerm],
+		insert_arg_unifications([InputTermVar], [InputTerm],
 			FunctorContext, ArgContext, Goal0,
 			VarSet3, Goal, VarSet, Info2, Info, SInfo2, SInfo)
 	;
@@ -7731,24 +7747,16 @@
 
 		{ TermArgContext = functor(Functor, MainContext, SubContext) },
 		{ TermArgNumber = 1 },
-		append_arg_unification(InputTermVar, InputTerm,
-			FunctorContext, TermArgContext, TermArgNumber,
-			TermUnifyConj, VarSet4, VarSet5, Info2, Info3,
-			SInfo2, SInfo3),
-
 		{ FieldArgContext = functor(InnerFunctor,
 			MainContext, FieldSubContext) },
 		{ FieldArgNumber = 2 },
-		append_arg_unification(FieldValueVar, FieldValueTerm,
-			FunctorContext, FieldArgContext, FieldArgNumber,
-			FieldUnifyConj, VarSet5, VarSet, Info3, Info,
-			SInfo3, SInfo),
-
-		{ Goal0 = _ - GoalInfo0 },
-		{ goal_to_conj_list(Goal0, GoalList0) },
-		{ list__condense([GoalList0, TermUnifyConj, FieldUnifyConj],
-			GoalList) },
-		{ conj_list_to_goal(GoalList, GoalInfo0, Goal) }
+		{ ArgContexts = [TermArgNumber - TermArgContext,
+				FieldArgNumber - FieldArgContext] },
+		insert_arg_unifications_with_supplied_contexts(
+			[InputTermVar, FieldValueVar],
+			[InputTerm, FieldValueTerm], ArgContexts,
+			Context, Goal0, VarSet4, Goal, VarSet, Info2, Info,
+			SInfo2, SInfo)
 	;
 		{ parse_qualified_term(RHS, RHS, "", MaybeFunctor) },
 		(
@@ -10121,7 +10129,7 @@
 	{ Name = varset__lookup_name(VarSet, StateVar) },
 	prog_out__write_context(Context),
 	report_warning(string__format("\
-Warning: reference to unitialized state variable !.%s.", [s(Name)])).
+Warning: reference to unitialized state variable !.%s.\n", [s(Name)])).
 
 %------------------------------------------------------------------------------%
 
Index: tests/invalid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/Mmakefile,v
retrieving revision 1.117
diff -u -r1.117 Mmakefile
--- tests/invalid/Mmakefile	26 Jul 2002 06:33:20 -0000	1.117
+++ tests/invalid/Mmakefile	31 Jul 2002 04:53:29 -0000
@@ -101,7 +101,6 @@
 	state_vars_test2.m \
 	state_vars_test3.m \
 	state_vars_test4.m \
-	state_vars_test5.m \
 	tc_err1.m \
 	tc_err2.m \
 	tricky_assert1.m \
Index: tests/invalid/aditi_update_errors.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/aditi_update_errors.err_exp,v
retrieving revision 1.5
diff -u -r1.5 aditi_update_errors.err_exp
--- tests/invalid/aditi_update_errors.err_exp	10 Jul 2001 10:45:36 -0000	1.5
+++ tests/invalid/aditi_update_errors.err_exp	29 Jul 2002 06:55:01 -0000
@@ -1,49 +1,49 @@
-aditi_update_errors.m:090: Error: wrong number of arguments (5; should be 3 or 4)
-aditi_update_errors.m:090:   in `aditi_bulk_modify'.
-aditi_update_errors.m:089: Error: expected
-aditi_update_errors.m:089:   `aditi_bulk_modify(
-aditi_update_errors.m:089:     (p(<Args0>) ==> p(<Args>) :- <Goal>),
-aditi_update_errors.m:089:     DB0, DB)'
-aditi_update_errors.m:089:   or `aditi_bulk_modify(PredOrFunc p/N, Closure, DB0, DB)'.
-aditi_update_errors.m:079: Error: wrong number of arguments (5; should be 3 or 4)
-aditi_update_errors.m:079:   in `aditi_bulk_modify'.
-aditi_update_errors.m:078: Error: expected
-aditi_update_errors.m:078:   `aditi_bulk_modify(
-aditi_update_errors.m:078:     (p(<Args0>) ==> p(<Args>) :- <Goal>),
-aditi_update_errors.m:078:     DB0, DB)'
-aditi_update_errors.m:078:   or `aditi_bulk_modify(PredOrFunc p/N, Closure, DB0, DB)'.
-aditi_update_errors.m:068: Error: expected
-aditi_update_errors.m:068:   `aditi_bulk_modify(
-aditi_update_errors.m:068:     (p(<Args0>) ==> p(<Args>) :- <Goal>),
-aditi_update_errors.m:068:     DB0, DB)'
-aditi_update_errors.m:068:   or `aditi_bulk_modify(PredOrFunc p/N, Closure, DB0, DB)'.
-aditi_update_errors.m:067: Error: expected
-aditi_update_errors.m:067:   `aditi_bulk_modify(
-aditi_update_errors.m:067:     (p(<Args0>) ==> p(<Args>) :- <Goal>),
-aditi_update_errors.m:067:     DB0, DB)'
-aditi_update_errors.m:067:   or `aditi_bulk_modify(PredOrFunc p/N, Closure, DB0, DB)'.
+aditi_update_errors.m:031: Error: expected tuple to insert in `aditi_insert'.
+aditi_update_errors.m:033: Error: wrong number of arguments (4; should be 3)
+aditi_update_errors.m:033:   in `aditi_insert'.
+aditi_update_errors.m:034: Error: wrong number of arguments (4; should be 3)
+aditi_update_errors.m:034:   in `aditi_insert'.
+aditi_update_errors.m:036: Error: wrong number of arguments (4; should be 3)
+aditi_update_errors.m:036:   in `aditi_delete'.
+aditi_update_errors.m:037: Error: wrong number of arguments (4; should be 3)
+aditi_update_errors.m:037:   in `aditi_delete'.
+aditi_update_errors.m:045: Error: expected `aditi_bulk_insert((p(<Args>) :- <Goal>), DB0, DB)'
+aditi_update_errors.m:045:   or `aditi_bulk_insert(PredOrFunc p/N, Closure, DB0, DB)'.
+aditi_update_errors.m:046: Error: wrong number of arguments (5; should be 3 or 4)
+aditi_update_errors.m:046:   in `aditi_bulk_delete'.
+aditi_update_errors.m:063: Error: expected `aditi_bulk_delete((p(<Args>) :- <Goal>), DB0, DB)'
+aditi_update_errors.m:063:   or `aditi_bulk_delete(PredOrFunc p/N, Closure, DB0, DB)'.
+aditi_update_errors.m:064: Error: wrong number of arguments (5; should be 3 or 4)
+aditi_update_errors.m:064:   in `aditi_bulk_delete'.
 aditi_update_errors.m:066: Error: expected
 aditi_update_errors.m:066:   `aditi_bulk_modify(
 aditi_update_errors.m:066:     (p(<Args0>) ==> p(<Args>) :- <Goal>),
 aditi_update_errors.m:066:     DB0, DB)'
 aditi_update_errors.m:066:   or `aditi_bulk_modify(PredOrFunc p/N, Closure, DB0, DB)'.
-aditi_update_errors.m:064: Error: wrong number of arguments (5; should be 3 or 4)
-aditi_update_errors.m:064:   in `aditi_bulk_delete'.
-aditi_update_errors.m:063: Error: expected `aditi_bulk_delete((p(<Args>) :- <Goal>), DB0, DB)'
-aditi_update_errors.m:063:   or `aditi_bulk_delete(PredOrFunc p/N, Closure, DB0, DB)'.
-aditi_update_errors.m:046: Error: wrong number of arguments (5; should be 3 or 4)
-aditi_update_errors.m:046:   in `aditi_bulk_delete'.
-aditi_update_errors.m:045: Error: expected `aditi_bulk_insert((p(<Args>) :- <Goal>), DB0, DB)'
-aditi_update_errors.m:045:   or `aditi_bulk_insert(PredOrFunc p/N, Closure, DB0, DB)'.
-aditi_update_errors.m:037: Error: wrong number of arguments (4; should be 3)
-aditi_update_errors.m:037:   in `aditi_delete'.
-aditi_update_errors.m:036: Error: wrong number of arguments (4; should be 3)
-aditi_update_errors.m:036:   in `aditi_delete'.
-aditi_update_errors.m:034: Error: wrong number of arguments (4; should be 3)
-aditi_update_errors.m:034:   in `aditi_insert'.
-aditi_update_errors.m:033: Error: wrong number of arguments (4; should be 3)
-aditi_update_errors.m:033:   in `aditi_insert'.
-aditi_update_errors.m:031: Error: expected tuple to insert in `aditi_insert'.
+aditi_update_errors.m:067: Error: expected
+aditi_update_errors.m:067:   `aditi_bulk_modify(
+aditi_update_errors.m:067:     (p(<Args0>) ==> p(<Args>) :- <Goal>),
+aditi_update_errors.m:067:     DB0, DB)'
+aditi_update_errors.m:067:   or `aditi_bulk_modify(PredOrFunc p/N, Closure, DB0, DB)'.
+aditi_update_errors.m:068: Error: expected
+aditi_update_errors.m:068:   `aditi_bulk_modify(
+aditi_update_errors.m:068:     (p(<Args0>) ==> p(<Args>) :- <Goal>),
+aditi_update_errors.m:068:     DB0, DB)'
+aditi_update_errors.m:068:   or `aditi_bulk_modify(PredOrFunc p/N, Closure, DB0, DB)'.
+aditi_update_errors.m:078: Error: expected
+aditi_update_errors.m:078:   `aditi_bulk_modify(
+aditi_update_errors.m:078:     (p(<Args0>) ==> p(<Args>) :- <Goal>),
+aditi_update_errors.m:078:     DB0, DB)'
+aditi_update_errors.m:078:   or `aditi_bulk_modify(PredOrFunc p/N, Closure, DB0, DB)'.
+aditi_update_errors.m:079: Error: wrong number of arguments (5; should be 3 or 4)
+aditi_update_errors.m:079:   in `aditi_bulk_modify'.
+aditi_update_errors.m:089: Error: expected
+aditi_update_errors.m:089:   `aditi_bulk_modify(
+aditi_update_errors.m:089:     (p(<Args0>) ==> p(<Args>) :- <Goal>),
+aditi_update_errors.m:089:     DB0, DB)'
+aditi_update_errors.m:089:   or `aditi_bulk_modify(PredOrFunc p/N, Closure, DB0, DB)'.
+aditi_update_errors.m:090: Error: wrong number of arguments (5; should be 3 or 4)
+aditi_update_errors.m:090:   in `aditi_bulk_modify'.
 aditi_update_errors.m:048: In clause for predicate `aditi_update_errors:aditi_update_syntax/2':
 aditi_update_errors.m:048:   warning: variable `X' has overlapping scopes.
 aditi_update_errors.m:070: In clause for predicate `aditi_update_errors:aditi_update_syntax/2':
@@ -146,14 +146,14 @@
 aditi_update_errors.m:152: In clause for predicate `aditi_update_errors:aditi_update_types/2':
 aditi_update_errors.m:152:   in argument 4 of clause head:
 aditi_update_errors.m:152:   in unification of argument
-aditi_update_errors.m:152:   and term `(X0 + V_91)':
+aditi_update_errors.m:152:   and term `(X0 + V_103)':
 aditi_update_errors.m:152:   type error in argument(s) of functor `+/2'.
 aditi_update_errors.m:152:   Argument 1 (X0) has type `(aditi:state)',
 aditi_update_errors.m:152:   expected type was `int'.
 aditi_update_errors.m:153: In clause for predicate `aditi_update_errors:aditi_update_types/2':
 aditi_update_errors.m:153:   in argument 4 of clause head:
 aditi_update_errors.m:153:   in unification of argument
-aditi_update_errors.m:153:   and term `(Y0 + V_87)':
+aditi_update_errors.m:153:   and term `(Y0 + V_107)':
 aditi_update_errors.m:153:   type error in argument(s) of functor `+/2'.
 aditi_update_errors.m:153:   Argument 1 (Y0) has type `((func int) = int)',
 aditi_update_errors.m:153:   expected type was `int'.
Index: tests/invalid/overloading.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/overloading.err_exp,v
retrieving revision 1.1
diff -u -r1.1 overloading.err_exp
--- tests/invalid/overloading.err_exp	10 Aug 2001 08:29:38 -0000	1.1
+++ tests/invalid/overloading.err_exp	29 Jul 2002 02:19:29 -0000
@@ -1,6 +1,6 @@
 overloading.m:050: In clause for predicate `overloading:p/4':
 overloading.m:050:   in unification of variable `OptInfo'
-overloading.m:050:   and term `opt_info(MustHaveOwnSlot, EverOnStack, CurIntervalId, V_17, Counter1, StartMap0, EndMap0, VarsMap0, SuccMap0)':
+overloading.m:050:   and term `opt_info(MustHaveOwnSlot, EverOnStack, CurIntervalId, V_22, Counter1, StartMap0, EndMap0, VarsMap0, SuccMap0)':
 overloading.m:050:   type error in argument(s) of functor `opt_info/9'.
 overloading.m:050:   variable `OptInfo' has type `(overloading:opt_info)',
 overloading.m:050:   functor `opt_info/9' has type 
Index: tests/invalid/record_syntax_errors.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/record_syntax_errors.err_exp,v
retrieving revision 1.8
diff -u -r1.8 record_syntax_errors.err_exp
--- tests/invalid/record_syntax_errors.err_exp	30 Jun 2002 17:07:20 -0000	1.8
+++ tests/invalid/record_syntax_errors.err_exp	29 Jul 2002 02:20:31 -0000
@@ -32,14 +32,14 @@
 record_syntax_errors.m:046: In clause for predicate `record_syntax_errors:arg_type_error/1':
 record_syntax_errors.m:046:   in argument 2 of functor `field6 :=/2':
 record_syntax_errors.m:046:   in unification of argument
-record_syntax_errors.m:046:   and term `'field7 :='(V_5, V_4)':
+record_syntax_errors.m:046:   and term `'field7 :='(V_10, V_9)':
 record_syntax_errors.m:046:   type error in argument(s) of functor `field7 :=/2'.
 record_syntax_errors.m:046:   Argument 2 has type `string',
 record_syntax_errors.m:046:   expected type was `int'.
 record_syntax_errors.m:050: In clause for predicate `record_syntax_errors:term_type_error/1':
 record_syntax_errors.m:050:   in argument 2 of functor `field6 :=/2':
 record_syntax_errors.m:050:   in unification of argument
-record_syntax_errors.m:050:   and term `'field4 :='(V_5, V_4)':
+record_syntax_errors.m:050:   and term `'field4 :='(V_10, V_9)':
 record_syntax_errors.m:050:   type error in argument(s) of functor `field4 :=/2'.
 record_syntax_errors.m:050:   Argument 1 has type `(record_syntax_errors:cons2)',
 record_syntax_errors.m:050:   expected type was `(record_syntax_errors:cons)'.
Index: tests/invalid/state_vars_test3.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/state_vars_test3.err_exp,v
retrieving revision 1.4
diff -u -r1.4 state_vars_test3.err_exp
--- tests/invalid/state_vars_test3.err_exp	27 Jul 2002 22:48:54 -0000	1.4
+++ tests/invalid/state_vars_test3.err_exp	31 Jul 2002 05:07:04 -0000
@@ -1 +1,7 @@
-state_vars_test3.m:022: Warning: reference to unitialized state variable !.X.
+state_vars_test3.m:021: Error: clause for function `state_vars_test3:f/2'
+state_vars_test3.m:021:   without preceding `func' declaration.
+state_vars_test3.m:021: Error: !Y cannot be a function result.
+state_vars_test3.m:021:   You probably meant !.Y or !:Y.
+state_vars_test3.m:015: Error: no clauses for function `state_vars_test3:f/1'.
+state_vars_test3.m:021: Error: no clauses for function `state_vars_test3:f/2'.
+For more information, try recompiling with `-E'.
Index: tests/invalid/state_vars_test3.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/state_vars_test3.m,v
retrieving revision 1.2
diff -u -r1.2 state_vars_test3.m
--- tests/invalid/state_vars_test3.m	22 Jul 2002 02:18:01 -0000	1.2
+++ tests/invalid/state_vars_test3.m	31 Jul 2002 05:04:26 -0000
@@ -12,12 +12,11 @@
 
 :- import_module int.
 
-:- pred p(int::out) is det.
+:- func f(int) = int.
 
 :- implementation.
 
-    % Warning about referring to "uninitialized" !.X.
+    % Illegally uses !Y as a func result.
     %
-p(!:X) :-
-    !.X = 1.
+f(!X) = !Y.
 
Index: tests/invalid/state_vars_test4.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/state_vars_test4.err_exp,v
retrieving revision 1.3
diff -u -r1.3 state_vars_test4.err_exp
--- tests/invalid/state_vars_test4.err_exp	27 Jul 2002 22:08:54 -0000	1.3
+++ tests/invalid/state_vars_test4.err_exp	31 Jul 2002 05:06:07 -0000
@@ -1,7 +1,7 @@
-state_vars_test4.m:021: Error: clause for function `state_vars_test4:f/2'
-state_vars_test4.m:021:   without preceding `func' declaration.
-state_vars_test4.m:021: Error: !Y cannot be a function result.
-state_vars_test4.m:021:   You probably meant !.Y or !:Y.
-state_vars_test4.m:015: Error: no clauses for function `state_vars_test4:f/1'.
-state_vars_test4.m:021: Error: no clauses for function `state_vars_test4:f/2'.
+state_vars_test4.m:021: Error: !X cannot be a lambda argument.
+state_vars_test4.m:021:   Perhaps you meant !.X or !:X.
+state_vars_test4.m:021: In clause for `f(in) = out':
+state_vars_test4.m:021:   in argument 1 of call to function `list:foldl/3':
+state_vars_test4.m:021:   mode error: variable `V_5' has instantiatedness `free',
+state_vars_test4.m:021:   expected instantiatedness was `(func((ground -> ground), (ground -> ground)) = (free -> ground) is det)'.
 For more information, try recompiling with `-E'.
Index: tests/invalid/state_vars_test4.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/state_vars_test4.m,v
retrieving revision 1.2
diff -u -r1.2 state_vars_test4.m
--- tests/invalid/state_vars_test4.m	22 Jul 2002 02:18:01 -0000	1.2
+++ tests/invalid/state_vars_test4.m	31 Jul 2002 05:04:12 -0000
@@ -10,13 +10,13 @@
 
 :- interface.
 
-:- import_module int.
+:- import_module list, int.
 
-:- func f(int) = int.
+:- func f(list(int)) = int.
 
 :- implementation.
 
-    % Illegally uses !Y as a func result.
+    % Illegally uses !X as a lambda arg.
     %
-f(!X) = !Y.
+f(Xs) = foldl(func(!X) = !.X * !:X, Xs, 1).
 
Index: tests/invalid/state_vars_test5.err_exp
===================================================================
RCS file: tests/invalid/state_vars_test5.err_exp
diff -N tests/invalid/state_vars_test5.err_exp
--- tests/invalid/state_vars_test5.err_exp	27 Jul 2002 22:08:54 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,7 +0,0 @@
-state_vars_test5.m:021: Error: !X cannot be a lambda argument.
-state_vars_test5.m:021:   Perhaps you meant !.X or !:X.
-state_vars_test5.m:021: In clause for `f(in) = out':
-state_vars_test5.m:021:   in argument 1 of call to function `list:foldl/3':
-state_vars_test5.m:021:   mode error: variable `V_5' has instantiatedness `free',
-state_vars_test5.m:021:   expected instantiatedness was `(func((ground -> ground), (ground -> ground)) = (free -> ground) is det)'.
-For more information, try recompiling with `-E'.
Index: tests/invalid/state_vars_test5.m
===================================================================
RCS file: tests/invalid/state_vars_test5.m
diff -N tests/invalid/state_vars_test5.m
--- tests/invalid/state_vars_test5.m	22 Jul 2002 02:18:01 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,22 +0,0 @@
-%------------------------------------------------------------------------------%
-% state_vars_test5.m
-% Ralph Becket <rafe at cs.mu.oz.au>
-% Thu May 30 14:22:14 EST 2002
-% vim: ft=mercury ff=unix ts=4 sw=4 et wm=0 tw=0
-%
-%------------------------------------------------------------------------------%
-
-:- module state_vars_test5.
-
-:- interface.
-
-:- import_module list, int.
-
-:- func f(list(int)) = int.
-
-:- implementation.
-
-    % Illegally uses !X as a lambda arg.
-    %
-f(Xs) = foldl(func(!X) = !.X * !:X, Xs, 1).
-
Index: tests/warnings/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/warnings/Mmakefile,v
retrieving revision 1.20
diff -u -r1.20 Mmakefile
--- Mmakefile	29 Jul 2002 13:17:38 -0000	1.20
+++ Mmakefile	31 Jul 2002 05:36:26 -0000
@@ -22,6 +22,7 @@
 	pragma_source_file \
 	simple_code \
 	singleton_test \
+	state_vars_test \
 	unused_args_test \
 	unused_import
 
Index: tests/warnings/state_vars_test.exp
===================================================================
RCS file: state_vars_test.exp
diff -N state_vars_test.exp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ state_vars_test.exp	31 Jul 2002 05:03:46 -0000
@@ -0,0 +1 @@
+state_vars_test.m:028: Warning: reference to unitialized state variable !.X.
Index: tests/warnings/state_vars_test.m
===================================================================
RCS file: state_vars_test.m
diff -N state_vars_test.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ state_vars_test.m	31 Jul 2002 05:02:19 -0000
@@ -0,0 +1,29 @@
+%------------------------------------------------------------------------------%
+% state_vars_test.m
+% Ralph Becket <rafe at cs.mu.oz.au>
+% Thu May 30 14:22:14 EST 2002
+% vim: ft=mercury ff=unix ts=4 sw=4 et wm=0 tw=0
+%
+%------------------------------------------------------------------------------%
+
+:- module state_vars_test.
+
+:- interface.
+
+:- import_module io.
+
+:- pred main(io::di, io::uo) is det.
+
+:- implementation.
+
+:- import_module int.
+
+main(!IO).
+
+:- pred p(int::out) is det.
+
+    % Warning about reference to "uninitialized" !.X.
+    %
+p(!:X) :-
+    !.X = 1.
+
--------------------------------------------------------------------------
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