[m-rev.] Bug found

Volker Wysk post at volker-wysk.de
Wed Oct 12 04:30:47 AEDT 2022


Hi.

The following program causes a compiler error. This happens only when its
name is "impure". The compiler doesn't like the "impure" module name. The
error can be triggered with a "program" that consists of nothing but the
module declaration.


:- module impure.

:- interface.
:- import_module io.

:- pred main(io::di, io::uo) is det.

:- implementation.
:- import_module exception, int.

:- impure pred wirf(int::in) is det.

wirf(I) :-
    impure impure_true,
    ( if I < 0 then throw("Geworfen.")
               else true ).


:- pragma promise_pure(main/2).

main(!IO) :-
    impure wirf(-1).



This is the error message:

impure.m:001: Error: module must start with a `:- module' declaration.


Bye
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20221011/a136e2f5/attachment-0001.sig>


More information about the reviews mailing list