Unexpected Compilation Error

General discussions about working with the Astrobe IDE and programming the Raspberry Pi RP2040 and the Pi Pico board.
Post Reply
gray
Posts: 177
Joined: Tue Feb 12, 2019 2:59 am
Location: Mauritius

Unexpected Compilation Error

Post by gray » Sun Aug 03, 2025 5:03 am

I have run into a puzzling compilation error, using the RP2350 command line compiler, latest version.

The following test case is distilled down from the real program by stepwise deletion of all code that does not make any change regarding the error message.

Code: Select all

MODULE Types;
  TYPE
    Actor* = POINTER TO ActorDesc;
    ReadyQ* = POINTER TO ReadyQdesc;
    ActorDesc* = RECORD
      rdyQ*: ReadyQ
    END;
    ReadyQdesc* = RECORD END;
END Types.

MODULE ReadyQueue;
  IMPORT Types;
  TYPE Queue* = Types.ReadyQ;
END ReadyQueue.

MODULE SysCall;
  IMPORT Types, ReadyQueue;
  PROCEDURE RQput*(q: Types.ReadyQ; act: Types.Actor);
  END RQput;
END SysCall.

MODULE Kernel;
  IMPORT Types, SysCall;
  PROCEDURE PutMsg*;
    VAR act: Types.Actor;
  BEGIN
    SysCall.RQput(act.rdyQ, act) (* <= compilation error *)
  END PutMsg;
END Kernel.
Compiling module Kernel fails at 'SysCall.RQput(act.rdyQ, act)' with error message 'Error: incompatible parameters' for 'act.rdyQ'.

Commenting out 'Queue* = Types.ReadyQ;' in module ReadyQueue (or not importing the module) resolves the issue. In the real program, I now omit the type definition in ReadyQueue, resorting to directly using 'Types.ReadyQ'.

cfbsoftware
Site Admin
Posts: 547
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: Unexpected Compilation Error

Post by cfbsoftware » Mon Aug 04, 2025 12:36 am

Thank you for your report - the whole issue of import ordering, re-importing and aliasing is very complex. e.g. another workaround for this example is to change the order of imports in SysCall to:

Code: Select all

IMPORT ReadyQueue, Types;
The IMPORT system was extensively refactored a year or so ago in an attempt to resolve these type of problems but there appears to be some problematic cases remaining. More work to be done ...

Post Reply