Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in WITH statement with pointers to related type extended records #117

Closed
Oleg-N-Cher opened this issue Jul 15, 2022 · 0 comments
Closed
Labels

Comments

@Oleg-N-Cher
Copy link
Owner

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.

Oleg-N-Cher added a commit that referenced this issue Jul 15, 2022
…xtended records (thanks to T. Kurt Bond to pointing this).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant