adimetrius / Herschel

Ground work for Component Pascal 64-bit compiler
BSD 2-Clause "Simplified" License
21 stars 1 forks source link

WITH statement is not useable #17

Open X547 opened 3 years ago

X547 commented 3 years ago

This is https://github.com/adimetrius/Herschel/commit/d429e326ad0857b768f75e5555021274427bb384.

When compiling following module, errors 85 (guarding or testing type is not an extension of variable's type) are produced, but it compiles and work fine with DevCompiler.

MODULE A;
    TYPE
        PointerMsg = RECORD
            x, y: INTEGER;
            btns: SET;
        END;

        KeyMsg = RECORD
            key: INTEGER;
            isDown: BOOLEAN;
        END;

    PROCEDURE HandleMsg (VAR msg: ANYREC);
    BEGIN
        WITH
        | msg: PointerMsg (* error 85 *) DO HALT(0)
        | msg: KeyMsg (* error 85 *) DO HALT(1)
        ELSE HALT(2) END;
    END HandleMsg;

END A.
X547 commented 3 years ago

Same error with msg(PointerMsg).x := 10;.

adimetrius commented 3 years ago

Dynamic variables and type extension Not Implemented Yet, as mentioned in the April 2021 Update on the website.