[m-rev.] Trivial change to make_hlds.m (state variable error formatting)

Ralph Becket rafe at cs.mu.OZ.AU
Mon Jul 22 12:17:27 AEST 2002


Estimated hours taken: 0.2
Branches: main

compiler/make_hlds.m:
	Removed redundant "\n"s from format arguments for report_error calls
	introduced in the state variable transformation.

tests/invalid/state_vars_test1.m:
tests/invalid/state_vars_test1.err_exp:
tests/invalid/state_vars_test2.m:
tests/invalid/state_vars_test2.err_exp:
tests/invalid/state_vars_test3.m:
tests/invalid/state_vars_test3.err_exp:
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:
	Minor clean-ups and changed the .err_exp files to match the
	expected output after the change to the error message
	formatting.

Index: compiler/make_hlds.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/make_hlds.m,v
retrieving revision 1.416
diff -u -r1.416 make_hlds.m
--- compiler/make_hlds.m	9 Jul 2002 06:53:41 -0000	1.416
+++ compiler/make_hlds.m	19 Jul 2002 06:28:05 -0000
@@ -10095,7 +10095,7 @@
 	{ Name = varset__lookup_name(VarSet, StateVar) },
 	prog_out__write_context(Context),
 	report_error(string__format("\
-cannot use !:%s in this context;\n", [s(Name)])),
+cannot use !:%s in this context;", [s(Name)])),
 	prog_out__write_context(Context),
 	io__format("\
   however !.%s may be used here.\n", [s(Name)]).
@@ -10110,7 +10110,7 @@
 	{ Name = varset__lookup_name(VarSet, StateVar) },
 	prog_out__write_context(Context),
 	report_error(string__format("\
-state variable !%s%s is not visible in this context.\n", [s(DorC), s(Name)])).
+state variable !%s%s is not visible in this context.", [s(DorC), s(Name)])).
 
 %------------------------------------------------------------------------------%
 
@@ -10121,7 +10121,7 @@
 	{ Name = varset__lookup_name(VarSet, StateVar) },
 	prog_out__write_context(Context),
 	report_warning(string__format("\
-Warning: reference to unitialized state variable !.%s.\n", [s(Name)])).
+Warning: reference to unitialized state variable !.%s.", [s(Name)])).
 
 %------------------------------------------------------------------------------%
 
@@ -10133,7 +10133,7 @@
 	{ Name = varset__lookup_name(VarSet, StateVar) },
 	prog_out__write_context(Context),
 	report_error(string__format("\
-!%s cannot be a function result.\n", [s(Name)])),
+!%s cannot be a function result.", [s(Name)])),
 	prog_out__write_context(Context),
 	io__format("\
   You probably meant !.%s or !:%s.\n", [s(Name), s(Name)]).
@@ -10148,7 +10148,7 @@
 	{ Name = varset__lookup_name(VarSet, StateVar) },
 	prog_out__write_context(Context),
 	report_error(string__format("\
-!%s cannot be a lambda argument.\n", [s(Name)])),
+!%s cannot be a lambda argument.", [s(Name)])),
 	prog_out__write_context(Context),
 	io__format("\
   Perhaps you meant !.%s or !:%s.\n", [s(Name), s(Name)]).
Index: tests/invalid/state_vars_test1.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/state_vars_test1.err_exp,v
retrieving revision 1.1
diff -u -r1.1 state_vars_test1.err_exp
--- tests/invalid/state_vars_test1.err_exp	9 Jul 2002 01:31:03 -0000	1.1
+++ tests/invalid/state_vars_test1.err_exp	19 Jul 2002 07:10:57 -0000
@@ -1,4 +1,3 @@
-state_vars_test1.m:  1: Warning: interface for module `state_vars_test1' does not export anything.
 state_vars_test1.m:023: Error: cannot use !:X in this context;
 
 state_vars_test1.m:023:   however !.X may be used here.
Index: tests/invalid/state_vars_test1.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/state_vars_test1.m,v
retrieving revision 1.1
diff -u -r1.1 state_vars_test1.m
--- tests/invalid/state_vars_test1.m	9 Jul 2002 01:31:04 -0000	1.1
+++ tests/invalid/state_vars_test1.m	19 Jul 2002 06:25:09 -0000
@@ -10,11 +10,11 @@
 
 :- interface.
 
-:- implementation.
-
 :- import_module int.
 
 :- pred p(int::in, int::out) is det.
+
+:- implementation.
 
     % Illegally refers to !:X in an if-then-else expr.
     %
Index: tests/invalid/state_vars_test2.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/state_vars_test2.err_exp,v
retrieving revision 1.1
diff -u -r1.1 state_vars_test2.err_exp
--- tests/invalid/state_vars_test2.err_exp	9 Jul 2002 01:31:05 -0000	1.1
+++ tests/invalid/state_vars_test2.err_exp	19 Jul 2002 07:10:57 -0000
@@ -1,4 +1,3 @@
-state_vars_test2.m:  1: Warning: interface for module `state_vars_test2' does not export anything.
 state_vars_test2.m:023: Error: state variable !:Y is not visible in this context.
 
 state_vars_test2.m:023: In clause for predicate `state_vars_test2:p/2':
Index: tests/invalid/state_vars_test2.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/state_vars_test2.m,v
retrieving revision 1.1
diff -u -r1.1 state_vars_test2.m
--- tests/invalid/state_vars_test2.m	9 Jul 2002 01:31:06 -0000	1.1
+++ tests/invalid/state_vars_test2.m	19 Jul 2002 06:25:09 -0000
@@ -10,11 +10,11 @@
 
 :- interface.
 
-:- implementation.
-
 :- import_module int.
 
 :- pred p(int::in, int::out) is det.
+
+:- implementation.
 
     % Illegally refers to !:Y, which has not been explicitly introduced.
     %
Index: tests/invalid/state_vars_test3.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/state_vars_test3.err_exp,v
retrieving revision 1.1
diff -u -r1.1 state_vars_test3.err_exp
--- tests/invalid/state_vars_test3.err_exp	9 Jul 2002 01:31:07 -0000	1.1
+++ tests/invalid/state_vars_test3.err_exp	19 Jul 2002 07:10:57 -0000
@@ -1,5 +1 @@
-state_vars_test3.m:  1: Warning: interface for module `state_vars_test3' does not export anything.
 state_vars_test3.m:022: Warning: reference to unitialized state variable !.X.
-state_vars_test3_init.o: In function `mercury_init':
-state_vars_test3_init.o(.text+0x2b6): undefined reference to `<predicate 'main'/2 mode 0>'
-collect2: ld returned 1 exit status
Index: tests/invalid/state_vars_test3.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/state_vars_test3.m,v
retrieving revision 1.1
diff -u -r1.1 state_vars_test3.m
--- tests/invalid/state_vars_test3.m	9 Jul 2002 01:31:08 -0000	1.1
+++ tests/invalid/state_vars_test3.m	19 Jul 2002 06:25:09 -0000
@@ -10,11 +10,11 @@
 
 :- interface.
 
-:- implementation.
-
 :- import_module int.
 
 :- pred p(int::out) is det.
+
+:- implementation.
 
     % Warning about referring to "uninitialized" !.X.
     %
Index: tests/invalid/state_vars_test4.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/state_vars_test4.err_exp,v
retrieving revision 1.1
diff -u -r1.1 state_vars_test4.err_exp
--- tests/invalid/state_vars_test4.err_exp	9 Jul 2002 01:31:09 -0000	1.1
+++ tests/invalid/state_vars_test4.err_exp	19 Jul 2002 07:10:58 -0000
@@ -1,9 +1,8 @@
-state_vars_test4.m:  1: Warning: interface for module `state_vars_test4' does not export anything.
 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:017: Error: no clauses for function `state_vars_test4:f/1'.
+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'.
 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.1
diff -u -r1.1 state_vars_test4.m
--- tests/invalid/state_vars_test4.m	9 Jul 2002 01:31:10 -0000	1.1
+++ tests/invalid/state_vars_test4.m	19 Jul 2002 06:25:09 -0000
@@ -10,11 +10,11 @@
 
 :- interface.
 
-:- implementation.
-
 :- import_module int.
 
 :- func f(int) = int.
+
+:- implementation.
 
     % Illegally uses !Y as a func result.
     %
Index: tests/invalid/state_vars_test5.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/state_vars_test5.err_exp,v
retrieving revision 1.1
diff -u -r1.1 state_vars_test5.err_exp
--- tests/invalid/state_vars_test5.err_exp	9 Jul 2002 01:31:11 -0000	1.1
+++ tests/invalid/state_vars_test5.err_exp	19 Jul 2002 07:10:58 -0000
@@ -1,4 +1,3 @@
-state_vars_test5.m:  1: Warning: interface for module `state_vars_test5' does not export anything.
 state_vars_test5.m:021: Error: !X cannot be a lambda argument.
 
 state_vars_test5.m:021:   Perhaps you meant !.X or !:X.
Index: tests/invalid/state_vars_test5.m
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/state_vars_test5.m,v
retrieving revision 1.1
diff -u -r1.1 state_vars_test5.m
--- tests/invalid/state_vars_test5.m	9 Jul 2002 01:31:12 -0000	1.1
+++ tests/invalid/state_vars_test5.m	19 Jul 2002 06:25:09 -0000
@@ -10,11 +10,11 @@
 
 :- interface.
 
-:- implementation.
-
 :- import_module list, int.
 
 :- func f(list(int)) = int.
+
+:- implementation.
 
     % Illegally uses !X as a lambda arg.
     %
--------------------------------------------------------------------------
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