Unexpected Compilation Error
Posted: 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.
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'.
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.
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'.