Commit Graph

3 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
caa865fd92 Fix a bug in the termination analyser where setting the termination
Estimated hours taken: 2
Branches: main

Fix a bug in the termination analyser where setting the termination
norm to `num-data-elems' causes the an internal abort when analysing
code involving existential typeclass constraints.

The bug is caused by the length of the list of arguments of a
functor differing from the length of the list in the weight table that
tells the compiler which arguments to count when computing the size
of that functor.

The length mismatch is caused by typeinfo related variables that
are introduced by the compiler for existentially typed terms.  The
termination analyser includes them but the weight table does not.
I committed a diff a few months ago that partially fixed this problem,
but programs that use existential typeclass constraints break that fix
as well.

The diff implements the easiest solution to all this which is to
have the termination analyser remove all the typeinfo related arguments
of a term before calling term_norm.functor_norm/9.

This diff also fixes a few things in the tests/term directory, namely
making sure that we actually run the tests, updating the module qualifier
in a few .trans_opt_exp files and updating some comments.

compiler/term_norm.m:
	Ignore any typeinfo related arguments that a term has when
	building the weight table.

compiler/term_traversal.m:
	Remove any typeinfo related arguments from the lists of
	arguments and modes before computing the size of a term.

tests/term/Mercury.options:
tests/term/existential_error3.m:
tests/term/existential_error3.trans_opt_exp:
	Add a regression test for this bug.

tests/term/Mmakefile:
	Make sure the $(TESTS) and $(PROGS) variables are fully defined
	before Mmake.common is included, otherwise the tests will not run.
	Add the new regression test.

tests/term/existential_error1.m:
tests/term/existential_error2.m:
	The code that caused these bugs has been moved from term_util.m
	to term_norm.m.  Update the references to the old filename.

tests/term/*.trans_opt_exp:
	Replaces instances of `:' as the module qualifier with `.'.
	Quite a few tests cases were failing because the .trans_opt
	files use the latter.
2003-12-08 03:42:16 +00:00
Julien Fischer
6028b6c1b1 Fix a bug that caused the termination analyser to abort when using
Estimated hours taken: 10
Branches: main

Fix a bug that caused the termination analyser to abort when using
the `num-data-elems' norm whilst analysing code that (de)constructs
existentially typed data types.

compiler/term_util.m:
	When building the weight table add any type_infos to the list
	of non-recursive arguments otherwise term_util.functor_norm/9 will
	throw an exception when processing an existentially typed data item.
	When calculating the weight do not add arguments that correspond
	to type_info related variables.

tests/term/existential_error1.m:
tests/term/existential_error2.m:
tests/term/existential_error1.trans_opt_exp:
tests/term/existential_error2.trans_opt_exp:
	Tests cases for above.

tests/term/Mmakefile:
tests/term/Mercury.options:
	Add new test cases.  Specify which norm to use on a case-by-case
	basis.
2003-10-08 05:12:40 +00:00