mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 18:03:36 +00:00
Estimated hours taken: 2
Branches: main
Fix a problem reported by Ian: the debugger ignored information about the head
variables of the predicates generated by the compiler from lambda expressions
because they didn't have names.
compiler/hlds_pred.m:
Add a predicate to ensure that all headvars have names.
compiler/lambda.m:
Call that predicate to give names to the predicates created from lambda
expressions.
compiler/code_gen.m:
Call that predicate to give names to the predicates created from lambda
expressions, in case other transformations also create predicates
with unnamed head variables.
doc/user_guide.texi:
Add a new mdb command, var_details, and a new method of invocation of
an existing mdb command, flag. I used them to track down this bug.
trace/mercury_trace_internal.c:
Implement the var_details mdb command, and the new method of invocation
of the flag command.
trace/mercury_trace_vars.[ch]:
Add a function to print variable details.
tests/debugger/mdb_command_test.inp:
Test the documentation of the new command.
tests/debugger/completion.exp:
Expect the new command.
tests/debugger/lambda_expr.{m,inp,exp}:
Add the new test case to test for the bug.
tests/debugger/Mmakefile:
Enable the new test case.
22 lines
510 B
Mathematica
22 lines
510 B
Mathematica
% This is a regression test. The version of the system on 16 July 2004
|
|
% generated bad RTTI for the lambda expression, which caused the debugger
|
|
% to believe that neither argument of the lambda predicate was instantiated.
|
|
|
|
:- module lambda_expr.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io :: di, io :: uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module int.
|
|
|
|
main(!IO) :-
|
|
P = (pred(X::in, Y::out) is det :- Y = X + 1),
|
|
P(1, Z),
|
|
io__write_int(Z, !IO),
|
|
io__nl(!IO).
|