mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-22 04:43:53 +00:00
Estimated hours taken: 2 compiler/simplify.m: Fix a bug where the code generator complained about `nondet model in semidet context': If a model_det or model_semi if-then-else has a model_nondet condition, then change the determinism of the if-then-else as a whole to nondet and put it inside a `some'. (This can only happen if the `then' part has determinism `erroneous' or `failure'.) The treatment of this problem for if-then-elses is similar to the way we treat the analgous problem for conjunctions. tests/valid/Mmake: tests/valid/tricky_ite.m: Regression test for the above bug fix.
22 lines
327 B
Mathematica
22 lines
327 B
Mathematica
:- module tricky_ite.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io__state::di, io__state::uo) is det.
|
|
|
|
:- implementation.
|
|
:- import_module int, require.
|
|
|
|
main -->
|
|
( { p(42, X) } ->
|
|
{ error("blah") },
|
|
write(X)
|
|
;
|
|
io__write_string("No.\n")
|
|
).
|
|
|
|
:- pred p(int::in, int::out) is nondet.
|
|
p(42, 1).
|
|
p(42, 2).
|
|
p(42, 3).
|