fcl-passrc: resolver: ord(integer)

git-svn-id: trunk@48236 -
This commit is contained in:
Mattias Gaertner 2021-01-20 21:21:56 +00:00
parent 7a3eb453d4
commit af5a6cd9d2
2 changed files with 6 additions and 4 deletions

View File

@ -19136,19 +19136,19 @@ begin
exit(cIncompatible);
Params:=TParamsExpr(Expr);
// first param: bool, enum or char
// first param: bool, integer, enum or char
Param:=Params.Params[0];
ComputeElement(Param,ParamResolved,[]);
Result:=cIncompatible;
if rrfReadable in ParamResolved.Flags then
begin
if ParamResolved.BaseType in (btAllBooleans+btAllChars) then
if ParamResolved.BaseType in btArrayRangeTypes then
Result:=cExact
else if (ParamResolved.BaseType=btContext) and (ParamResolved.LoTypeEl is TPasEnumType) then
Result:=cExact
else if ParamResolved.BaseType=btRange then
begin
if ParamResolved.SubType in btAllBooleans+btAllChars then
if ParamResolved.SubType in btArrayRangeTypes then
Result:=cExact
else if ParamResolved.SubType=btContext then
begin

View File

@ -3359,8 +3359,10 @@ begin
' i2: TInt2;',
'begin',
' i:=i2;',
' if i=i2 then ;']);
' if i=i2 then ;',
' i:=ord(i);']);
ParseProgram;
CheckResolverUnexpectedHints;
end;
procedure TTestResolver.TestIntegerRangeHighLowerLowFail;