[m-users.] Determinism error caused by instantiation error, not sure why.

Sean Charles (emacstheviking) objitsu at gmail.com
Mon Oct 31 10:11:44 AEDT 2022


The error:

repl.m:738: In `take_gencall'(in, out, in, out, in, out):
repl.m:738:   error: determinism declaration not satisfied.
repl.m:738:   Declared `det', inferred `semidet'.
repl.m:747: In clause for `take_gencall(in, out, in, out, in, out)':
repl.m:747:   warning: unification of `Out' and maybe.yes cannot succeed.
repl.m:747:   `Out' has instantiatedness `unique(no)'.

The code:

:- pred take_gencall(error_msg::in, maybe(snode)::out, s::in, s::out,
    lsnode::in, lsnode::out) is det.

take_gencall(Er, Out, !S) -->
    ( if no_errors(!.S) then
        ( if [GC] then
            { Pos = snpos(GC) },
            ( if { GC = gencall(_, _, _) } then
                 { Out = yes(GC) }   <== line 747
            else
                cerror(Pos, Er, !S),
                { Out = no }
            )
        else
            premature(!S)),
            { Out = no }
    else
        { Out = no }
    ).

For the life of me I don't understand why the line in bold is causing an error, why has Out become `unique(no)` and does that no refer to a general no or is it the no from the may() discriminated union, I just don't see my mistake. Sorry.

Thanks,
Sean.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20221030/3c7edcc1/attachment-0003.html>


More information about the users mailing list