diff: improve error messages
Fergus Henderson
fjh at cs.mu.OZ.AU
Thu Oct 29 20:19:21 AEDT 1998
Estimated hours taken: 1
Minor improvements to some compiler error messages.
compiler/modules.m:
Fix a missing close-quote in an error message.
Also improve the wording of the message slightly.
compiler/check_typeclass.m:
compiler/typecheck.m:
Add quotes (`...') in a couple of places
tests/invalid/sub*.err_exp:
tests/invalid/typeclass_test*.err_exp:
Update to reflect the new error messages.
tests/invalid/Mmakefile:
Delete an obsolete comment about a poor error message.
Index: compiler/check_typeclass.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/check_typeclass.m,v
retrieving revision 1.16
diff -u -r1.16 check_typeclass.m
--- check_typeclass.m 1998/09/22 16:12:42 1.16
+++ check_typeclass.m 1998/10/29 08:15:03
@@ -314,16 +314,16 @@
mercury_type_list_to_string(InstanceVarSet, InstanceTypes,
InstanceTypesString),
string__append_list([
- "In instance declaration for ",
+ "In instance declaration for `",
ClassNameString,
"(",
InstanceTypesString,
- "): ",
- "multiple implementations of type class method ",
+ ")': ",
+ "multiple implementations of type class method `",
MethodNameString,
"/",
PredArityString,
- "."],
+ "'."],
ErrorHeader),
I1 = _ - I1Context,
Heading =
@@ -352,16 +352,16 @@
mercury_type_list_to_string(InstanceVarSet, InstanceTypes,
InstanceTypesString),
string__append_list([
- "In instance declaration for ",
+ "In instance declaration for `",
ClassNameString,
"(",
InstanceTypesString,
- "): ",
- "no implementation for type class method ",
+ ")': ",
+ "no implementation for type class method `",
MethodNameString,
"/",
PredArityString,
- "."],
+ "'."],
NewError),
Errors = [InstanceContext - [words(NewError)] | Errors0],
Info = instance_method_info(ModuleInfo, PredName, PredArity,
@@ -632,11 +632,11 @@
constraint_list_to_string(ClassVarSet, UnprovenConstraints,
ConstraintsString),
string__append_list([
- "In instance declaration for ",
+ "In instance declaration for `",
ClassNameString,
"(",
InstanceTypesString,
- "): ",
+ ")': ",
"superclass constraint(s) not satisfied: ",
ConstraintsString,
"."],
@@ -652,7 +652,7 @@
constraint_list_to_string(VarSet, [C|Cs], String) :-
mercury_constraint_to_string(VarSet, C, String0),
constraint_list_to_string_2(VarSet, Cs, String1),
- string__append(String0, String1, String).
+ string__append_list(["`", String0, "'", String1], String).
:- pred constraint_list_to_string_2(varset, list(class_constraint), string).
:- mode constraint_list_to_string_2(in, in, out) is det.
@@ -661,6 +661,6 @@
constraint_list_to_string_2(VarSet, [C|Cs], String) :-
mercury_constraint_to_string(VarSet, C, String0),
constraint_list_to_string_2(VarSet, Cs, String1),
- string__append_list([", ", String0, String1], String).
+ string__append_list([", `", String0, "'", String1], String).
%---------------------------------------------------------------------------%
Index: compiler/modules.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/modules.m,v
retrieving revision 1.88
diff -u -r1.88 modules.m
--- modules.m 1998/10/28 06:15:04 1.88
+++ modules.m 1998/10/29 07:57:53
@@ -3132,11 +3132,11 @@
very_long_name.m:123: In module `very_long_name':
very_long_name.m:123: error in `import_module' declaration:
very_long_name.m:123: module `parent_module:sub_module' is inaccessible.
-very_long_name.m:123: Either there was no `import_module' or `use_module'
-very_long_name.m:123: declaration importing module `parent_module',
-very_long_name.m:123: or the interface for module `parent_module'
-very_long_name.m:123: does not contain an `include_module' declaration
-very_long_name.m:123: for module `sub_module'.
+very_long_name.m:123: Either there was no prior `import_module' or
+very_long_name.m:123: `use_module' declaration to import module
+very_long_name.m:123: `parent_module', or the interface for module
+very_long_name.m:123: `parent_module' does not contain an `include_module'
+very_long_name.m:123: declaration for module `sub_module'.
*/
report_inaccessible_module_error(ModuleName, ParentModule, SubModule,
@@ -3161,21 +3161,21 @@
globals__io_lookup_bool_option(verbose_errors, VerboseErrors),
( { VerboseErrors = yes } ->
prog_out__write_context(Context),
- io__write_string(" Either there was no `import_module' or "),
- io__write_string("`use_module'\n"),
+ io__write_string(" Either there was no prior "),
+ io__write_string("`import_module' or\n"),
prog_out__write_context(Context),
- io__write_string(" declaration to import module `"),
- prog_out__write_sym_name(ParentModule),
- io__write_string("',\n"),
+ io__write_string(" `use_module' declaration to import "),
+ io__write_string("module\n"),
prog_out__write_context(Context),
- io__write_string(" or the interface for module `"),
+ io__write_string(" `"),
prog_out__write_sym_name(ParentModule),
- io__write_string("\n"),
+ io__write_string("', or the interface for module\n"),
prog_out__write_context(Context),
- io__write_strings([" does not contain an `include_module' ",
- "declaration\n"]),
+ io__write_string(" `"),
+ prog_out__write_sym_name(ParentModule),
+ io__write_string("' does not contain an `include_module'\n"),
prog_out__write_context(Context),
- io__write_string(" for module `"),
+ io__write_string(" declaration for module `"),
io__write_string(SubModule),
io__write_string("'.\n")
;
Index: compiler/typecheck.m
===================================================================
RCS file: /home/mercury1/repository/mercury/compiler/typecheck.m,v
retrieving revision 1.253
diff -u -r1.253 typecheck.m
--- typecheck.m 1998/10/29 03:55:17 1.253
+++ typecheck.m 1998/10/29 09:05:22
@@ -3194,10 +3194,10 @@
list__sort_and_remove_dups(UnprovenConstraints1,
UnprovenConstraints),
prog_out__write_context(Context, IO0, IO1),
- io__write_string(" ", IO1, IO2),
- io__write_list(UnprovenConstraints, ", ",
+ io__write_string(" `", IO1, IO2),
+ io__write_list(UnprovenConstraints, "', `",
mercury_output_constraint(VarSet), IO2, IO3),
- io__write_string(".\n", IO3, IO)
+ io__write_string("'.\n", IO3, IO)
)),
% XXX this won't be very pretty when there are
Index: tests/invalid/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/Mmakefile,v
retrieving revision 1.33
diff -u -r1.33 Mmakefile
--- Mmakefile 1998/10/29 09:16:43 1.33
+++ Mmakefile 1998/10/29 09:18:37
@@ -65,9 +65,6 @@
# parent.undeclared_child.m (just not yet implemented)
# sub_b.m and sub_c.m (bug with dependencies & nested modules)
# freefree.m (need bromage's aliasing stuff)
-#
-# we do a very bad job on the following tests:
-# typeclass_test_4.m (awful error message)
MCFLAGS-multisoln_func = --infer-types
MCFLAGS-any_mode = --infer-types
Index: tests/invalid/typeclass_test_1.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/typeclass_test_1.err_exp,v
retrieving revision 1.4
diff -u -r1.4 typeclass_test_1.err_exp
--- typeclass_test_1.err_exp 1998/07/10 00:14:12 1.4
+++ typeclass_test_1.err_exp 1998/10/29 08:11:34
@@ -3,5 +3,5 @@
typeclass_test_1.m:017: Syntax error at variable `_': operator or `.' expected.
typeclass_test_1.m:007: In clause for predicate `typeclass_test_1:main/2':
typeclass_test_1.m:007: unsatisfiable typeclass constraint(s):
-typeclass_test_1.m:007: typeclass_test_1:numbered_type(int).
+typeclass_test_1.m:007: `typeclass_test_1:numbered_type(int)'.
For more information, try recompiling with `-E'.
Index: tests/invalid/typeclass_test_2.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/typeclass_test_2.err_exp,v
retrieving revision 1.7
diff -u -r1.7 typeclass_test_2.err_exp
--- typeclass_test_2.err_exp 1998/07/10 00:14:13 1.7
+++ typeclass_test_2.err_exp 1998/10/29 08:15:59
@@ -3,6 +3,6 @@
typeclass_test_2.m:023: without preceding `func' declaration.
typeclass_test_2.m:010: In clause for predicate `typeclass_test_2:main/2':
typeclass_test_2.m:010: unsatisfiable typeclass constraint(s):
-typeclass_test_2.m:010: typeclass_test_2:numbered_type(int).
+typeclass_test_2.m:010: `typeclass_test_2:numbered_type(int)'.
typeclass_test_2.m:023: Inferred :- func foo_type_num(T1) = int.
For more information, try recompiling with `-E'.
Index: tests/invalid/typeclass_test_3.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/typeclass_test_3.err_exp,v
retrieving revision 1.6
diff -u -r1.6 typeclass_test_3.err_exp
--- typeclass_test_3.err_exp 1998/09/23 04:45:08 1.6
+++ typeclass_test_3.err_exp 1998/10/29 08:16:11
@@ -1,5 +1,5 @@
typeclass_test_3.m:014: In instance declaration for
-typeclass_test_3.m:014: typeclass_test_3:numbered_type(int): no
+typeclass_test_3.m:014: `typeclass_test_3:numbered_type(int)': no
typeclass_test_3.m:014: implementation for type class method
-typeclass_test_3.m:014: typeclass_test_3:type_num/2.
+typeclass_test_3.m:014: `typeclass_test_3:type_num/2'.
For more information, try recompiling with `-E'.
Index: tests/invalid/typeclass_test_4.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/typeclass_test_4.err_exp,v
retrieving revision 1.4
diff -u -r1.4 typeclass_test_4.err_exp
--- typeclass_test_4.err_exp 1998/09/23 04:45:10 1.4
+++ typeclass_test_4.err_exp 1998/10/29 08:16:17
@@ -1,5 +1,5 @@
typeclass_test_4.m:014: In instance declaration for
-typeclass_test_4.m:014: typeclass_test_4:numbered_type(int): no
+typeclass_test_4.m:014: `typeclass_test_4:numbered_type(int)': no
typeclass_test_4.m:014: implementation for type class method
-typeclass_test_4.m:014: typeclass_test_4:type_num/2.
+typeclass_test_4.m:014: `typeclass_test_4:type_num/2'.
For more information, try recompiling with `-E'.
Index: tests/invalid/typeclass_test_5.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/typeclass_test_5.err_exp,v
retrieving revision 1.2
diff -u -r1.2 typeclass_test_5.err_exp
--- typeclass_test_5.err_exp 1998/09/23 04:45:12 1.2
+++ typeclass_test_5.err_exp 1998/10/29 08:16:31
@@ -1,9 +1,9 @@
-typeclass_test_5.m:015: In instance declaration for typeclass_test_5:c2(int):
+typeclass_test_5.m:015: In instance declaration for `typeclass_test_5:c2(int)':
typeclass_test_5.m:015: multiple implementations of type class method
-typeclass_test_5.m:015: typeclass_test_5:p/1.
+typeclass_test_5.m:015: `typeclass_test_5:p/1'.
typeclass_test_5.m:016: First definition appears here.
typeclass_test_5.m:017: Subsequent definition appears here.
-typeclass_test_5.m:015: In instance declaration for typeclass_test_5:c2(int):
+typeclass_test_5.m:015: In instance declaration for `typeclass_test_5:c2(int)':
typeclass_test_5.m:015: superclass constraint(s) not satisfied:
-typeclass_test_5.m:015: typeclass_test_5:c1(int).
+typeclass_test_5.m:015: `typeclass_test_5:c1(int)'.
For more information, try recompiling with `-E'.
Index: tests/invalid/typeclass_test_7.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/typeclass_test_7.err_exp,v
retrieving revision 1.2
diff -u -r1.2 typeclass_test_7.err_exp
--- typeclass_test_7.err_exp 1998/10/07 04:07:55 1.2
+++ typeclass_test_7.err_exp 1998/10/29 08:16:38
@@ -1,4 +1,4 @@
typeclass_test_7.m:010: In clause for predicate `typeclass_test_7:p/2':
typeclass_test_7.m:010: unsatisfiable typeclass constraint(s):
-typeclass_test_7.m:010: typeclass_test_7:numbered_type(T).
+typeclass_test_7.m:010: `typeclass_test_7:numbered_type(T)'.
For more information, try recompiling with `-E'.
Index: tests/invalid/typeclass_test_8.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/typeclass_test_8.err_exp,v
retrieving revision 1.2
diff -u -r1.2 typeclass_test_8.err_exp
--- typeclass_test_8.err_exp 1998/07/08 20:59:48 1.2
+++ typeclass_test_8.err_exp 1998/10/29 08:16:53
@@ -1,6 +1,6 @@
typeclass_test_8.m:004: In predicate `typeclass_test_8:main/2':
typeclass_test_8.m:004: type error: unsatisfied typeclass constraint(s):
-typeclass_test_8.m:004: typeclass_test_8:fooable(T).
+typeclass_test_8.m:004: `typeclass_test_8:fooable(T)'.
typeclass_test_8.m:004: In predicate `typeclass_test_8:main/2':
typeclass_test_8.m:004: warning: unresolved polymorphism.
typeclass_test_8.m:004: The variable with an unbound type was:
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list