fcl-passrc: resolver: int64(currency)

git-svn-id: trunk@39942 -
This commit is contained in:
Mattias Gaertner 2018-10-16 07:27:52 +00:00
parent d9be52c759
commit 3f08a6c05c
2 changed files with 14 additions and 3 deletions

View File

@ -16208,7 +16208,7 @@ begin
else
begin
{$IFDEF VerbosePasResEval}
writeln('TPasResolver.CheckAssignExprRange ',Frac(TResEvalFloat(RValue).FloatValue),' ',TResEvalFloat(RValue).FloatValue<MaxPrecFloat(low(MaxPrecInt)),' ',TResEvalFloat(RValue).FloatValue>MaxPrecFloat(high(MaxPrecInt)),' ',TResEvalFloat(RValue).FloatValue,' ',high(MaxPrecInt));
writeln('TPasResolver.CheckAssignExprRange ',Frac(TResEvalFloat(RValue).FloatValue),' ',TResEvalFloat(RValue).FloatValue<TMaxPrecFloat(low(TMaxPrecInt)),' ',TResEvalFloat(RValue).FloatValue>TMaxPrecFloat(high(TMaxPrecInt)),' ',TResEvalFloat(RValue).FloatValue,' ',high(TMaxPrecInt));
{$ENDIF}
RaiseRangeCheck(20170802133750,RHS);
end;
@ -16222,7 +16222,7 @@ begin
else
begin
{$IFDEF VerbosePasResEval}
writeln('TPasResolver.CheckAssignExprRange ',Frac(TResEvalCurrency(RValue).Value),' ',TResEvalCurrency(RValue).Value,' ',high(MaxPrecInt));
writeln('TPasResolver.CheckAssignExprRange ',Frac(TResEvalCurrency(RValue).Value),' ',TResEvalCurrency(RValue).Value,' ',high(TMaxPrecInt));
{$ENDIF}
RaiseRangeCheck(20180421171438,RHS);
end;
@ -18628,7 +18628,7 @@ begin
Result:=cExact
else if ToTypeBaseType in btAllInteger then
begin
if FromResolved.BaseType in (btArrayRangeTypes+[btRange]) then
if FromResolved.BaseType in (btArrayRangeTypes+[btRange,btCurrency]) then
Result:=cCompatible
else if FromResolved.BaseType=btContext then
begin

View File

@ -2791,7 +2791,10 @@ begin
' c=double(currency(-123456890123456));',
' d=currency(-1);',
' e=currency(word(-1));',
'var',
' i: longint = 1;',
' i64: int64;',
' f: double;',
'begin',
' a:=i;',
' a:=i+a;',
@ -2807,6 +2810,14 @@ begin
' a:=i*a;',
' a:=a/i;',
' a:=i/a;',
' a:=i64;',
' a:=currency(i64);',
//' i64:=a;', not allowed
' i64:=int64(a);', // truncates a
' a:=f;',
' a:=currency(f);',
' f:=a;',
' f:=double(a);',
'']);
ParseProgram;
CheckResolverUnexpectedHints;