[m-rev.] Line number bug in error message

Volker Wysk post at volker-wysk.de
Thu Nov 14 04:38:41 AEDT 2024


Hello

I think I have found an error in error message generation. It's in the
following code:

:- pred get_result1(odbc.result(T), T).
:- mode get_result1(in, out) is det.
:- mode get_result1(in(bound(odbc.ok(unique, ground) ; odbc.error(ground))),
out(unique)) is det.

get_result1(Res, Val) :-
    (
        Res = ok(Val, _)
    ;
        Res = error(Messages),
        throw(odbc_error(Messages))      % <- line 251
    ).

The error message is this:

test.m:251: In clause for `get_result1(in(bound(odbc.error(ground) ;
odbc.ok(unique, ground))), out(unique))':
test.m:251:   mode error: argument 1 had the wrong instantiatedness.
test.m:251:   Final instantiatedness of `Res' was `bound(ok(ground,
ground))',
test.m:251:   expected final instantiatedness was
test.m:251:     bound(
test.m:251:       error(ground)
test.m:251:     ;
test.m:251:       ok(unique, ground)
test.m:251:     ).

I think the line should be the one containing "Res = ok(Val, _)".

Cheers,
Volker


More information about the reviews mailing list