IS operator precendence is wrong
Original Reporter info from Mantis: kluug.net @onpok
-
Reporter name: Ondrej Pokorny
Original Reporter info from Mantis: kluug.net @onpok
- Reporter name: Ondrej Pokorny
Description:
According to
https://www.freepascal.org/docs-html/ref/refch12.html and
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Expressions_(Delphi)#Operator_Precedence
the is operator has the lowest precedence.
But in reality it is not so. The compiler evaluates the IS operator before OR.
Steps to reproduce:
program IS_Precedence;
uses
Classes;
var
O1, O2: TObject;
begin
O1 := TComponent.Create(nil);
O2 := TObject.Create;
Writeln(O1 is TComponent or O2 is TComponent); // <<< should not compile because OR has precedence before IS
end.
Additional information:
Delphi (correctly) fails to compile the program in "Steps To Reproduce".
Mantis conversion info:
- Mantis ID: 35909
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 44266 (#bc313168)
- Monitored by: » @KaiBurghardt (Kai Burghardt)