From 3f08a6c05c0978b28b4c077116f5ef3c3c71d95b Mon Sep 17 00:00:00 2001 From: Mattias Gaertner Date: Tue, 16 Oct 2018 07:27:52 +0000 Subject: [PATCH] fcl-passrc: resolver: int64(currency) git-svn-id: trunk@39942 - --- packages/fcl-passrc/src/pasresolver.pp | 6 +++--- packages/fcl-passrc/tests/tcresolver.pas | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/fcl-passrc/src/pasresolver.pp b/packages/fcl-passrc/src/pasresolver.pp index 5ea72e01c1..d4098a23bd 100644 --- a/packages/fcl-passrc/src/pasresolver.pp +++ b/packages/fcl-passrc/src/pasresolver.pp @@ -16208,7 +16208,7 @@ begin else begin {$IFDEF VerbosePasResEval} - writeln('TPasResolver.CheckAssignExprRange ',Frac(TResEvalFloat(RValue).FloatValue),' ',TResEvalFloat(RValue).FloatValueMaxPrecFloat(high(MaxPrecInt)),' ',TResEvalFloat(RValue).FloatValue,' ',high(MaxPrecInt)); + writeln('TPasResolver.CheckAssignExprRange ',Frac(TResEvalFloat(RValue).FloatValue),' ',TResEvalFloat(RValue).FloatValueTMaxPrecFloat(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 diff --git a/packages/fcl-passrc/tests/tcresolver.pas b/packages/fcl-passrc/tests/tcresolver.pas index 436d12ed81..7152289342 100644 --- a/packages/fcl-passrc/tests/tcresolver.pas +++ b/packages/fcl-passrc/tests/tcresolver.pas @@ -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;