[fpc-devel] AS/IS operators for enums

Ondrej Pokorny lazarus at kluug.net
Sun Apr 15 14:18:47 CEST 2018

I uploaded a new patch to add enum support to AS/IS operators to 

1.) I added support for the IS operator.
2.) I added support of any ordinal type (int/enum) on the left side of 
the operator:
   E: TMyEnum;
   E := E as TMyEnum; // check if E is valid value
   if E is TMyEnum then // check if E is valid value

3.) I added support for compile-time constant evaluation as Sven suggested.

4.) I uploaded new test case projects for both AS and IS operators.


I did not add support to any integer type on the right side:
if I is Byte then // not supported

because the boundaries of int64 and uint64 types make the whole story 
too complicated for me and I don't need it. If anybody wants this 
feature, feel free to implement it yourself.


More information about the fpc-devel mailing list