mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 08:59:26 +02:00
fcl-passrc: resolver: fixed high(intvar)
git-svn-id: trunk@39906 -
This commit is contained in:
parent
9d7308df42
commit
27a9d53dd2
@ -12577,9 +12577,8 @@ begin
|
||||
Param:=Params.Params[0];
|
||||
ComputeElement(Param,ParamResolved,[]);
|
||||
Result:=cIncompatible;
|
||||
if not (rrfReadable in ParamResolved.Flags)
|
||||
and (ParamResolved.BaseType in btAllRanges) then
|
||||
// built-in range e.g. high(char)
|
||||
if ParamResolved.BaseType in btAllRanges then
|
||||
// e.g. high(char)
|
||||
Result:=cExact
|
||||
else if ParamResolved.BaseType=btSet then
|
||||
Result:=cExact
|
||||
@ -12592,7 +12591,12 @@ begin
|
||||
Result:=cExact;
|
||||
end;
|
||||
if Result=cIncompatible then
|
||||
begin
|
||||
{$IFDEF VerbosePasResolver}
|
||||
writeln('TPasResolver.BI_LowHigh_OnGetCallCompatibility ParamResolved=',GetResolverResultDbg(ParamResolved));
|
||||
{$ENDIF}
|
||||
exit(CheckRaiseTypeArgNo(20170216152338,1,Param,ParamResolved,'ordinal type, array or set',RaiseOnError));
|
||||
end;
|
||||
|
||||
Result:=CheckBuiltInMaxParamCount(Proc,Params,1,RaiseOnError);
|
||||
end;
|
||||
|
@ -3016,8 +3016,12 @@ begin
|
||||
' MaxInt = +10;',
|
||||
'type',
|
||||
' {#TMyInt}TMyInt = MinInt..MaxInt;',
|
||||
'const a = low(TMyInt)+High(TMyInt);',
|
||||
'begin']);
|
||||
'const',
|
||||
' a = low(TMyInt)+High(TMyInt);',
|
||||
'var',
|
||||
' i: TMyInt;',
|
||||
'begin',
|
||||
' i:=low(i)+high(i);']);
|
||||
ParseProgram;
|
||||
CheckResolverUnexpectedHints;
|
||||
end;
|
||||
|
@ -5316,7 +5316,9 @@ begin
|
||||
' i: TMyInt;',
|
||||
'begin',
|
||||
' i:=-MinInt;',
|
||||
' i:=default(TMyInt);']);
|
||||
' i:=default(TMyInt);',
|
||||
' i:=low(i)+high(i);',
|
||||
'']);
|
||||
ConvertProgram;
|
||||
CheckSource('TestIntegerRange',
|
||||
LinesToStr([
|
||||
@ -5328,6 +5330,7 @@ begin
|
||||
LinesToStr([
|
||||
'$mod.i = - -4503599627370496;',
|
||||
'$mod.i = -4503599627370496;',
|
||||
'$mod.i = -4503599627370496 + 4503599627370495;',
|
||||
'']));
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user