Replace __ with . as the module qualifier symbol.
Replace references to io.state with just io.
Replace DCGs with state variables.
Replace (C->T;E) syntax for if-then-elses with (if C then T else E) syntax.
Replace if-then-elses with switches when possible and where this does not
affect what is being tested.
Replace separate pred and mode declarations with predmode declarations.
Put predicate and function declarations just before the definition
of the predicate or function.
Delete unneeded module qualifications on predicate and function declarations
and definitions.
Update .exp files (and if needed, .inp files) for the line number changes
that result from the above.
For tests that have more than one .exp file and where one of those files
is affected by the above, add a section to the source file header that says
which .exp file is for what grade, with XXXs for the (as yet) unknown parts.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
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 debugger tests,
specify the new line numbers in .inp files and expect them in .exp files.
Estimated hours taken: 6
Branches: main
Fix two bugs in the printing of goals where the predicate concerned is an
compiler-generated unify, compare or index predicate. Improve the mechanisms
for debugging bugs like this.
runtime/mercury_layout_util.[ch]:
Fix bug one: do not return the arity of a type constructor as
the arity of the unify, compare or index predicate of that
type constructor; return the actual arity. When the falsely
returned arity was greater than the actual arity, we could get
core dumps; when it was smaller, the mdb command "print goal"
printed wrong output.
Provide a mechanism for fixing bug two: add a utility function
for computing *correctly* a procedure's original arity and the number
of type_info and/or typeclass_info arguments added by the compiler.
(For convenience, it also returns a predicate/function indication.)
runtime/mercury_stack_layout.h:
Rename the MR_comp_arity field of MR_Compiler_Proc_Id to
MR_comp_type_arity, to make clear that it gives the arity of the type
constructor, not the arity of the predicate, and thus avoid bugs such
as those above.
runtime/mercury_stack_trace.c:
Use the new name of the MR_comp_type_arity field.
trace/mercury_trace_declarative.c:
trace/mercury_trace_vars.c:
Call the new, correct utility function in runtime/mercury_layout_util
to compute how many typeinfo and/or typeclassinfo arguments are added
by the compiler to a unify, compare, or index procedure's arguments,
instead of the different, but logically equivalent and equally wrong
pieces of code here.
trace/mercury_trace_external.c:
Use the new name of the MR_comp_type_arity field. Leave an XXX, since
I am not sure whether Morphine interprets the arity as the arity of the
type constructor or as the arity of the predicate.
runtime/mercury_engine.[ch]:
runtime/mercury_layout_util.c:
Make the printing of locations obtained from RTTI data structures
switchable from mdb, to make problems like this easier to debug.
tests/debugger/uci.{m,inp,exp}:
A new test case to test the proper handling of unify, compare and index
predicates.
tests/debugger/Mercury.options:
tests/debugger/Mmakefile:
Enable the new test case.