Commit Graph

2 Commits

Author SHA1 Message Date
Zoltan Somogyi
fdd141bf77 Clean up the tests in the other test directories.
tests/invalid/*.{m,err_exp}:
tests/misc_tests/*.m:
tests/mmc_make/*.m:
tests/par_conj/*.m:
tests/purity/*.m:
tests/stm/*.m:
tests/string_format/*.m:
tests/structure_reuse/*.m:
tests/submodules/*.m:
tests/tabling/*.m:
tests/term/*.m:
tests/trailing/*.m:
tests/typeclasses/*.m:
tests/valid/*.m:
tests/warnings/*.{m,exp}:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the tests
    that check compiler error messages, expect the new line numbers.

browser/cterm.m:
browser/tree234_cc.m:
    Import only one module per line.

tests/hard_coded/boyer.m:
    Fix something I missed.
2015-02-16 12:32:18 +11:00
Julien Fischer
8b73df26ee Allow repeated type variables in type class instance heads.
The Mercury compiler has long required that all of the type variables referred
to in type class instance head be distinct.  There is no particularly good
reason for this restriction -- the implication that it helps to ensure that
there are no overlapping instances in the reference manual is misleading, since
the way that we do that (at least in the C grades), by using the names of the
base_typeclass_infos, is not affected by type variables.

The major implementation detail needed to support repeated type variables in
instance declarations is that when doing context reduction, we must do full
matching of instances against constraints (i.e. we need to keep track of the
type variable bindings).  Since we already do this, the only change required to
support repeated type variables is to remove the error checking that prevents
it.

compiler/check_typeclass.m:
	Do not require that type variables in instance heads be distinct.

doc/reference_manual.texi:
	Document that repeated type variables are now allowed in instance
	heads.

NEWS:
	Announce the change.

tests/invalid/instance_dup_var.m:
	Shift this test into the valid directory.

tests/invalid/repeated_instance_vars_unsat.{m,err_exp}:
     Check that we get an error if a repeated type variable is bound
     to different types.

tests/valid/Mmakefile:
tests/invalid/Mmakefile:
	Conform to the above changes.

tests/invalid/invalid_instance_declarations.err_exp:
tests/invalid/invalid_instance_declarations.m:
	Remove instances that are now valid.
2013-07-09 15:43:48 +10:00