Herschel icon indicating copy to clipboard operation
Herschel copied to clipboard

WITH statement is not useable

Open X547 opened this issue 3 years ago • 2 comments

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 avatar Apr 13 '21 04:04 X547

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

X547 avatar Apr 13 '21 04:04 X547

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

adimetrius avatar Apr 13 '21 20:04 adimetrius