mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 02:43:40 +00:00
tests/general/float_test.exp3:
tests/general/float_test.m:
tests/general/read_dir_regression.exp4:
tests/general/read_dir_regression.m:
tests/hard_coded/remove_file.exp2:
tests/hard_coded/remove_file.m:
Delete Erlang backend specific expected outputs.
tests/hard_coded/Mmakefile:
tests/hard_coded/erlang_deconstruct.exp:
tests/hard_coded/erlang_deconstruct.m:
tests/hard_coded/existential_list.exp:
tests/hard_coded/existential_list.m:
tests/valid/Mmakefile:
tests/valid/erl_ite_vars.m:
tests/valid/zf_erlang_bug.m:
Delete erlang target specific tests.
tests/*:
Delete Erlang foreign procs and foreign types.
76 lines
2.8 KiB
Mathematica
76 lines
2.8 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ft=mercury ts=4 sw=4 et
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% This is a regression test. Versions of the compiler before 2019 April 7
|
|
% used to get a compiler abort for this module. The reason was that
|
|
%
|
|
% - We first inserted the declaration of the predicate named "mark"
|
|
% near the bottom of the file into the predicate table.
|
|
%
|
|
% - Later we tried to insert the declaration of the class method predicate
|
|
% named "mark" near the top of the file into the predicate table.
|
|
% This insertion failed, but it nevertheless returned a valid pred_proc_id
|
|
% to the code handling the addition of the class methods to the HLDS.
|
|
% This was the pred_proc_id resulting from the first, successful insertion.
|
|
%
|
|
% - The compiler expects every predicate that represents a class method
|
|
% to have at least one universal typeclass constraint on it, this being
|
|
% the constraint implicit in its nature as a typeclass method. The code
|
|
% that checks typeclass constraints aborts if it does not find it.
|
|
% In this case, it did not find it, since we added into the pred_info
|
|
% we constructed it for the second, unsuccessful insertion, but this
|
|
% never made it into the HLDS.
|
|
%
|
|
|
|
:- module bug476.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- typeclass input_stream(T) where [
|
|
pred mark(T::in, int::in, io::di, io::uo) is det
|
|
].
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- type jinput_stream.
|
|
|
|
:- instance input_stream(jinput_stream).
|
|
|
|
%---------------------------------------------------------------------------%
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- import_module require.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- pragma foreign_type("C", jinput_stream, "void *").
|
|
:- pragma foreign_type("C#", jinput_stream, "object").
|
|
:- pragma foreign_type("Java", jinput_stream, "java.io.InputStream").
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- instance input_stream(jinput_stream) where [
|
|
pred(mark/4) is input_stream_mark
|
|
].
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
% The name of this declaration is INCORRECT.
|
|
% The bug was tickled by the coincidence between the name of this predicate
|
|
% and the class method predicate above.
|
|
%
|
|
:- pred mark(jinput_stream::in, int::in, io::di, io::uo) is det.
|
|
|
|
input_stream_mark(_, _, _) :-
|
|
error("NYI mark for InputStream").
|
|
|
|
%---------------------------------------------------------------------------%
|
|
:- end_module bug476.
|
|
%---------------------------------------------------------------------------%
|