gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cumbersome error messages with CMPLX() / RE() / IM()


From: Michael Riedl
Subject: Cumbersome error messages with CMPLX() / RE() / IM()
Date: Tue, 28 Nov 2023 22:58:27 +0100
User-agent: Mozilla/5.0 (X11; Linux i686; rv:102.0) Gecko/20100101 Thunderbird/102.11.0

Gaius,

may I ask you to cross-check the following short code:

MODULE TstCmplx;

PROCEDURE MkCmplx(re,im : REAL) : COMPLEX;

BEGIN
      RETURN CMPLX(re,im);
END MkCmplx;

VAR   re,im : REAL;
         x       : COMPLEX;
BEGIN

      x  := MkCmplx(2.0,1.0);
      re := RE(x);
      im := IM(x);


END TstCmplx.


On my side it produces quite some strange error messages (using GM2 version 13.2.1 20231123):

mriedl@laptop:~/Modula-2/GM2/bug1$gm2 TstCmplx.mod
TstCmplx.mod:6:14: error: In procedure 'MkCmplx': too many parameters, 1 passed to 'CMPLX'
    6 |       RETURN CMPLX(re,im);
      |              ^~~~~
TstCmplx.mod:6:14: error: attempting to pass too many parameters to procedure 'CMPLX', the 2nd parameter does not exist TstCmplx.mod:6:14: error: attempting to pass too many parameters to procedure 'CMPLX', the 1st parameter does not exist TstCmplx.mod:6:14: error: attempting to pass (2) parameters to procedure (CMPLX) which was declared with (0) parameters <built-in>: error: attempting to pass (2) parameters to procedure (CMPLX) which was declared with (0) parameters
TstCmplx.mod:6:14: error: too many parameters, 2 passed to 'CMPLX'
TstCmplx.mod:14:13: error: In program module 'TstCmplx': attempting to pass too many parameters to procedure 'RE', the 1st parameter does not exist
   14 |       re := RE(x);
      |             ^~
TstCmplx.mod:14:13: error: attempting to pass (1) parameters to procedure (RE) which was declared with (0) parameters <built-in>: error: attempting to pass (1) parameters to procedure (RE) which was declared with (0) parameters
TstCmplx.mod:14:13: error: too many parameters, 1 passed to 'RE'
TstCmplx.mod:15:13: error: attempting to pass too many parameters to procedure 'IM', the 1st parameter does not exist
   15 |       im := IM(x);
      |             ^~
TstCmplx.mod:15:13: error: attempting to pass (1) parameters to procedure (IM) which was declared with (0) parameters <built-in>: error: attempting to pass (1) parameters to procedure (IM) which was declared with (0) parameters
TstCmplx.mod:15:13: error: too many parameters, 1 passed to 'IM'

Thanks

Michael




reply via email to

[Prev in Thread] Current Thread [Next in Thread]