Open
Description
When I compile the following program with Vishap Oberon:
MODULE example;
IMPORT Out;
TYPE
(** A rope. *)
T* = POINTER TO TDesc;
TDesc = RECORD
END;
(** Alias for type Rope.T. *)
Rope* = T;
PAoC = POINTER TO ARRAY OF CHAR;
SubNode = POINTER TO SubDesc;
SubDesc = RECORD (TDesc)
s: PAoC;
start: LONGINT;
length: LONGINT;
END;
CatNode = POINTER TO CatDesc;
CatDesc = RECORD (TDesc)
height: LONGINT;
length: LONGINT;
left: T;
leftLength: LONGINT;
right: T;
END;
PROCEDURE print (r: T);
BEGIN
Out.Char ('(');
WITH r: SubNode DO
Out.String ('SubNode: start: '); Out.Int (r.start, 0);
Out.String (' length: '); Out.Int (r.length, 0);
| r: CatNode DO
Out.String ('CatNode: height: '); Out.Int (r.height, 0);
Out.String (' length: '); Out.Int (r.length, 0);
Out.String (' leftLength: '); Out.Int (r.leftLength, 0);
Out.String (' left: ');
print (r.left);
Out.String (' right: ');
print (r.right);
ELSE
Out.String ('Length: impossible error: r is not SubNode or CatNode'); Out.Ln;
END;
Out.Char (')');
END print;
END example.
I get this error:
voc -f example.Mod -m
example.Mod Compiling example.
43: print (r.left);
^
pos 985 err 113 incompatible assignment
45: print (r.right);
^
pos 1043 err 113 incompatible assignment
Module compilation failed.
Both of the other Oberon-2 compilers I tried with (oo2c and obc) compiled this without error, but I can't use either of them for the project from which this example is extracted (oo2c has a bug that makes the project fail, for instance).
Metadata
Metadata
Assignees
Labels
No labels