mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-24 22:04:13 +00:00
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.
38 lines
1.2 KiB
Mathematica
38 lines
1.2 KiB
Mathematica
%
|
|
% Regression test for an abort in code generation.
|
|
% When the actual type for a polymorphic argument is non-polymorphic,
|
|
% only the base_type_info is passed, avoiding the construction of
|
|
% a type_info. The problem was that the type of the type_info argument
|
|
% was being set to `mercury_builtin:base_type_info' rather than
|
|
% `type_info'. In the code to compute the type substitution in inlining,
|
|
% type_list_subsumes failed on the argument types, and no substitution
|
|
% was produced. code_util__cons_id_to_tag then aborted when asked to
|
|
% find the tag for a constructor of a variable type.
|
|
%
|
|
:- module inlining_bug.
|
|
|
|
:- interface.
|
|
|
|
:- pred calling_pred(int::in) is semidet.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module int, list.
|
|
|
|
:- type my_pair(A) ---> pair(A, A).
|
|
|
|
calling_pred(_) :-
|
|
Plus1 = (pred(Int0::in, IntPair::out) is det :-
|
|
IntPair = pair(Int0, Int0)),
|
|
called_pred(Plus1, [1,2,3], [X | Ys]),
|
|
X = pair(2, 2),
|
|
Ys = [pair(3, 3), pair(4, 4)].
|
|
|
|
:- pred called_pred(pred(T, U), list(T), list(U)) is det.
|
|
:- mode called_pred(pred(in, out) is det, in, out) is semidet.
|
|
:- pragma inline(called_pred/3).
|
|
|
|
called_pred(P, [A | As], [B | Bs]) :-
|
|
call(P, A, B),
|
|
list__map(P, As, Bs).
|