Files
mercury/tests/hard_coded/intermod_try_goal.m
Peter Wang 1e0025b820 Do not opt-export `try' goals.
This fixes a serious issue as `try' goals are not properly written to
.opt files, so when read back would not actually catch any exceptions.
Bug #420.

At the point where we are to create the .opt file, the pieces of a `try'
goal exist in a "pre-transformed" hlds_goal. Teasing apart the pieces to
resemble the original `try' goal would be non-trivial.

compiler/intermod.m:
        Do not export any predicate or function with a clause containing a
        `try' goal.

library/exception.m
	Throw an exception if the dummy predicate
	`magic_exception_result/1' is ever called.

tests/hard_coded/Mercury.options:
tests/hard_coded/Mmakefile:
tests/hard_coded/intermod_try_goal.exp:
tests/hard_coded/intermod_try_goal.m:
tests/hard_coded/intermod_try_goal2.m:
	Add test case.

NEWS:
	Announce change.
2016-09-19 14:27:57 +10:00

30 lines
601 B
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
:- module intermod_try_goal.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is cc_multi.
:- implementation.
:- import_module exception.
:- import_module intermod_try_goal2.
main(!IO) :-
catcher(thrower, !IO),
io.write_string("done.\n", !IO).
:- pred thrower(io::di, io::uo) is det.
thrower(!IO) :-
( if semidet_true then
throw("catch me")
else
true
).