[m-rev.] Improved type error message

Ralph Becket rafe at cs.mu.OZ.AU
Wed Feb 6 18:05:39 AEDT 2002


Estimated hours taken: 1
Branches: main

compiler/typecheck.m:
	Improved how actual/expected type errors are reported.

Index: typecheck.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.308
diff -u -r1.308 typecheck.m
--- typecheck.m	25 Sep 2001 09:36:55 -0000	1.308
+++ typecheck.m	6 Feb 2002 07:02:06 -0000
@@ -5324,7 +5324,6 @@
 		io__write_string(" has overloaded actual/expected types {\n"),
 
 		prog_out__write_context(Context),
-		io__write_string("    "),
 		write_var_type_stuff_list(TypeStuffList, Type),
 		io__write_string("\n"),
 
@@ -5407,29 +5406,31 @@
 :- mode write_var_type_stuff_list(in, in, di, uo) is det.
 
 write_var_type_stuff_list(Ts, T) -->
-	io__write_list(Ts, ", ", write_var_type_stuff(T)).
+	io__write_list(Ts, ",\n", write_var_type_stuff(T)).
 
 :- pred write_var_type_stuff(type, type_stuff, io__state, io__state).
 :- mode write_var_type_stuff(in, in, di, uo) is det.
 	
 write_var_type_stuff(T, type_stuff(VT, TVarSet, TBinding)) -->
+	io__write_string(   "    (actual)   "),
 	write_type_b(VT, TVarSet, TBinding),
-	io__write_string("/"),
+	io__write_string(",\n    (expected) "),
 	write_type_b(T, TVarSet, TBinding).
 
 :- pred write_arg_type_stuff_list(list(arg_type_stuff), io__state, io__state).
 :- mode write_arg_type_stuff_list(in, di, uo) is det.
 
 write_arg_type_stuff_list(Ts) -->
-	io__write_list(Ts, ", ", write_arg_type_stuff).
+	io__write_list(Ts, ",\n", write_arg_type_stuff).
 
 :- pred write_arg_type_stuff(arg_type_stuff, io__state, io__state).
 :- mode write_arg_type_stuff(in, di, uo) is det.
 
 write_arg_type_stuff(arg_type_stuff(T0, VT0, TVarSet)) -->
 	{ strip_builtin_qualifiers_from_type(VT0, VT) },
+	io__write_string(   "    (actual)   "),
 	mercury_output_term(VT, TVarSet, no),
-	io__write_string("/"),
+	io__write_string(",\n    (expected) "),
 	{ strip_builtin_qualifiers_from_type(T0, T) },
 	mercury_output_term(T, TVarSet, no).
 
--------------------------------------------------------------------------
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