vishapoberon/compiler

parameter doesn't match (SYSTEM.ADDRESS)

aixp opened this issue · 2 comments

aixp commented
MODULE A;

	IMPORT SYSTEM;

	TYPE
		T* = PROCEDURE (adr: SYSTEM.ADDRESS);

	PROCEDURE P* (t: T);
	BEGIN
	END P;

END A.
MODULE B;

	IMPORT SYSTEM, A;

	PROCEDURE P0 (adr: SYSTEM.ADDRESS);
	BEGIN
	END P0;

	PROCEDURE P;
	BEGIN
		A.P(P0)
	END P;

END B.
$ voc A.Mod B.Mod
A.Mod  Compiling A.  New symbol file.  339 chars.
B.Mod  Compiling B.

  11: 		A.P(P0)
             ^
    pos   113  err 115  parameter doesn't match

Module compilation failed.
$ voc | head -2 | tail -1
Oberon-2 compiler v2.1.0 [2019/11/15] for gcc LP64 on ubuntu.
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 19.04
Release:	19.04
Codename:	disco

Yes. Reproduces for me. I agree - I think it should work.

Here's a workaround:

MODULE A;
IMPORT SYSTEM;

TYPE
  ADDRESS* = SYSTEM.ADDRESS;
  T* = PROCEDURE (adr: ADDRESS);

  PROCEDURE P*(t: T);
  BEGIN
  END P;

END A.
MODULE B;
IMPORT SYSTEM, A;

  PROCEDURE P0(adr: A.ADDRESS);
  BEGIN
  END P0;

  PROCEDURE P;
  BEGIN
    A.P(P0)
  END P;

END B.
voc -s a.mod b.mod -m
a.mod  Compiling A.  340 chars.
b.mod  Compiling B.  Main program.  449 chars.

Will this work for you?

It may be the symbol fingerprinting code, that took me a long time to understand last time I needed to work on it, and I've forgotten everything I knew :-(.

Or it may be deeper - I think PROCEDURE type equivalence has some special case code.

-- Dave.

aixp commented

Yes, it works for me.