[m-dev.] Re: diff: check for unbound type vars in class constraints
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Aug 16 19:20:01 AEST 2000
On 16-Aug-2000, Fergus Henderson <fjh at cs.mu.oz.au> wrote:
>
> Check for various cases of type variables that occur only in type class
> constraints. These cases are all errors, since the type variable can
> never be bound, but previously the compiler was not checking for these
> errors.
...
> compiler/make_hlds.m:
> Check that type vars in constraints on pred and func declarations
> (including type class methods) occur in the procedure's argument types.
> This enforces the following requirement from the "type class
> constraints on predicates and functions" section of the Mercury
> language reference manual:
> | where ... TYPEVARIABLE is a type variable that appears in the
> | predicate's or function's type signature.
I forgot to see if that change would affect any of the other .err_exp
files in tests/invalid. It turns out that I need to make the following
additional change.
----------
tests/invalid/typeclass_test_9.err_exp:
Update the expected output for this change to reflect
the additional errors output as a result of my recent change.
The change in question was the one compiler/make_hlds.m to
make it report errors for type variables in constraints
that do not occur in the procedure's argument types.
Index: typeclass_test_9.err_exp
===================================================================
RCS file: /home/mercury1/repository/tests/invalid/typeclass_test_9.err_exp,v
retrieving revision 1.1
diff -u -d -u -r1.1 typeclass_test_9.err_exp
--- typeclass_test_9.err_exp 1999/02/12 04:19:31 1.1
+++ typeclass_test_9.err_exp 2000/08/16 09:08:54
@@ -2,6 +2,14 @@
typeclass_test_9.m:001: warning: module `std_util'
typeclass_test_9.m:001: is imported in the interface, but is not
typeclass_test_9.m:001: used in the interface.
+typeclass_test_9.m:004: In declaration for predicate `typeclass_test_9:p/0':
+typeclass_test_9.m:004: error in type class constraints: type variable
+typeclass_test_9.m:004: `T' occurs only in the constraints,
+typeclass_test_9.m:004: not in the predicate's argument types.
+typeclass_test_9.m:006: In declaration for predicate `typeclass_test_9:q/0':
+typeclass_test_9.m:006: error in type class constraints: type variable
+typeclass_test_9.m:006: `T' occurs only in the constraints,
+typeclass_test_9.m:006: not in the predicate's argument types.
typeclass_test_9.m:010: Error: multiply defined (or overlapping) instance
typeclass_test_9.m:010: declarations for class `typeclass_test_9:foo/1'.
typeclass_test_9.m:007: Previous instance declaration was here.
--
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.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list