Files
mercury/tests/valid/lambda_instmap_bug.m
Julien Fischer c0dffb491e Deprecate old-style lambda expressions properly.
Estimated hours taken: 3
Branches: main

Deprecate old-style lambda expressions properly.

compiler/make_hlds.m:
	Emit a warning if an old-style lambda expression is
	encountered.

compiler/notes/todo.html:
	Remove this from the TODO list.

compiler/base_typeclass_info.m:
compiler/mercury_to_mercury.m:
extras/odbc/odbc.m:
tests/*/*.m:
	Replace old-style lambda expressions as necessary.
2004-07-14 05:39:14 +00:00

35 lines
832 B
Mathematica

% Regression test for a case where cse_detection.m, det_analysis.m
% and simplify.m were not updating the instmap before processing
% a lambda expression, causing an abort in determinism analysis.
:- module lambda_instmap_bug.
:- interface.
:- import_module list, set, std_util.
:- type instr == pair(instruction, string).
:- type instruction
---> clear(int)
; drop(int)
; join(int, int, int).
:- pred detect_streams(set(int), list(instr), list(instr)).
:- mode detect_streams(in, in, out) is det.
:- implementation.
detect_streams(Streams, Instrs0, Instrs) :-
% Don't attempt to clear or drop streams.
IsNotStreamClear =
(pred(Instr::in) is semidet :-
\+ (
( Instr = clear(Rel) - _
; Instr = drop(Rel) - _
),
set__member(Rel, Streams)
)
),
list__filter(IsNotStreamClear, Instrs0, Instrs).