From bc3131688af996b30fe4acc2e2b55d953ab70f8b Mon Sep 17 00:00:00 2001 From: florian Date: Fri, 6 Mar 2020 10:10:58 +0000 Subject: [PATCH] * fix precedence of IS operator, resolves #35909 git-svn-id: trunk@44266 - --- .gitattributes | 1 + compiler/tokens.pas | 4 ++-- packages/fcl-report/src/fpreport.pp | 2 +- tests/webtbf/tw35909.pp | 12 ++++++++++++ 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 tests/webtbf/tw35909.pp diff --git a/.gitattributes b/.gitattributes index 9806cbb5e9..99fe03765e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16221,6 +16221,7 @@ tests/webtbf/tw35671.pp svneol=native#text/plain tests/webtbf/tw35753.pp svneol=native#text/plain tests/webtbf/tw3583.pp svneol=native#text/plain tests/webtbf/tw35866.pp svneol=native#text/pascal +tests/webtbf/tw35909.pp svneol=native#text/pascal tests/webtbf/tw35981.pp svneol=native#text/pascal tests/webtbf/tw36114.pp svneol=native#text/pascal tests/webtbf/tw36223.pp svneol=native#text/pascal diff --git a/compiler/tokens.pas b/compiler/tokens.pas index dd6cd2a716..e7b677e755 100644 --- a/compiler/tokens.pas +++ b/compiler/tokens.pas @@ -344,10 +344,10 @@ const { Warning these stay be ordered !! } operator_levels:array[Toperator_precedence] of set of NOTOKEN..last_operator= - ([_LT,_LTE,_GT,_GTE,_EQ,_NE,_OP_IN], + ([_LT,_LTE,_GT,_GTE,_EQ,_NE,_OP_IN,_OP_IS], [_PLUS,_MINUS,_OP_OR,_PIPE,_OP_XOR], [_CARET,_SYMDIF,_STARSTAR,_STAR,_SLASH, - _OP_AS,_OP_IS,_OP_AND,_AMPERSAND,_OP_DIV,_OP_MOD,_OP_SHL,_OP_SHR], + _OP_AS,_OP_AND,_AMPERSAND,_OP_DIV,_OP_MOD,_OP_SHL,_OP_SHR], [_STARSTAR] ); type diff --git a/packages/fcl-report/src/fpreport.pp b/packages/fcl-report/src/fpreport.pp index 119a6fc24c..49a3c19cf3 100644 --- a/packages/fcl-report/src/fpreport.pp +++ b/packages/fcl-report/src/fpreport.pp @@ -12283,7 +12283,7 @@ begin if CurrentLoop.FGroupHeaderList.Count > 0 then begin { when data band overflows use start with lowest gropup header } - if aBand is TFPReportCustomDataBand and + if (aBand is TFPReportCustomDataBand) and not Assigned(TFPReportCustomDataBand(aband).MasterBand) then lToMoveGrp := TFPReportCustomGroupHeaderBand(CurrentLoop.FGroupHeaderList[0]) { when group header overflows use start with parent group header } diff --git a/tests/webtbf/tw35909.pp b/tests/webtbf/tw35909.pp new file mode 100644 index 0000000000..529378ce42 --- /dev/null +++ b/tests/webtbf/tw35909.pp @@ -0,0 +1,12 @@ +{ %fail% } +{$mode delphi} +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.