Oleg-N-Cher/OfrontPlus

Error in WITH statement with pointers to related type extended records

Oleg-N-Cher opened this issue · 0 comments

The problem mentioned in vishapoberon/compiler#98
Simplified source:

MODULE example;

  TYPE
    (** A rope. *)
    T* = POINTER TO TDesc;
    TDesc = EXTENSIBLE RECORD
    END;

    (** Alias for type Rope.T. *)
    Rope* = T;

    SubNode = POINTER TO SubDesc;
    SubDesc = RECORD (TDesc)
    END;

    CatNode = POINTER TO CatDesc;
    CatDesc = RECORD (TDesc)
      left: T;
      right: T;
    END;      

    PROCEDURE print (r: T);
    BEGIN
      WITH r: SubNode DO
      | r: CatNode DO
        print (r.left);
        print (r.right);
      ELSE
      END;
    END print;

END example.

The solution taken from BlackBox.