Commit Graph

3 Commits

Author SHA1 Message Date
Zoltan Somogyi
3dc4babb24 Update the style of more test cases.
And update expected output files for changes in line numbers.
2021-07-27 13:29:46 +10:00
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
Zoltan Somogyi
28aeed3834 Gneerate an error message for instance definitions that specify a type
Estimated hours taken: 6
Branches: main

Gneerate an error message for instance definitions that specify a type
that is an abstract exported equivalence type.

compiler/prog_item.m:
compiler/hlds_data.m:
	Add fields to the parse tree and HLDS representations of instance
	definitions to preserve the original types they contain.

compiler/prog_io_typeclass.m:
	When creating instance definitions, duplicate the type field.

compiler/add_class.m:
compiler/make_hlds_passes.m:
	Copy the field from the parse tree to the HLDS.

compiler/equiv_type.m:
	When replacing equivalence types in instance definitions, leave
	unchanged the copies of the original types in the new field.

	This expansion is done BEFORE we construct the item list we convert
	to the HLDS. The complete erasure of the original types done by
	previous versions of the compiler is why those versions couldn't
	generate the error messages generated by this diff.

compiler/check_typeclass.m:
	Generate the error message in circumstances that call for it.
	In this error message, mention the types the user wrote, not
	the expanded types.

	Also do several kinds of cleanups.

        First, this modules does several different checks. Put the code that
        does those checks in the same order as the comment at the top
        explaining them, and the order in which they are executed.

        Second, give some predicates and variables more meaningful names.

        Third, fix the error messages so that they form complete sentences,
        and do not use abbreviations unnecessarily.

compiler/hlds_out_module.m:
	Print out the new field.

compiler/base_typeclass_info.m:
compiler/dead_proc_elim.m:
compiler/higher_order.m:
compiler/intermod.m:
compiler/mercury_to_mercury.m:
compiler/module_qual.m:
compiler/polymorphism.m:
compiler/recompilation.usage.m:
compiler/recompilation.version.m:
	Ignore the extra field, or copy it unchanged.

tests/invalid/constraint_proof_bug_lib.{m,err_exp}:
	A test case for this diff. This module is a copy of
	tests/valid/constraint_proof_bug_lib.m with cleaned-up syntax.
	This module has an instance definition for an abstract exported
	equivalence type.

tests/invalid/Mmakefile:
	Enable the new test case.

tests/invalid/bad_instance.err_exp:
tests/invalid/instance_dup_var.err_exp:
tests/invalid/instance_var_bug.err_exp:
tests/invalid/invalid_instance_declarations.err_exp:
tests/invalid/invalid_typeclass.err_exp:
	Update the expected error messages for the third cleanup change above.

tests/valid/Mmakefile:
	Disable the constraint_proof_bug test case, since its
	constraint_proof_bug_lib.m module has the bug we now test for.
	The only reason why the test case ever passed (why the bug
	was not caught at link time, as it was designed to be caught)
	is that the code in constraint_proof_bug.m that needs the bad instance
	definition is dead code, and is eliminated as such.

tests/invalid/constraint_proof_bug_lib.m:
	Adopt the cleanup from the copy in the invalid directory.
2012-06-05 15:14:29 +00:00