소스 검색

* Evaluate currency constant expressions when the currency type is 64-bit integer. Issue #28749.

git-svn-id: trunk@33334 -
yury 9 년 전
부모
커밋
d4d70d3865
3개의 변경된 파일19개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      .gitattributes
  2. 4 0
      compiler/nadd.pas
  3. 14 0
      tests/webtbs/tw28749.pp

+ 1 - 0
.gitattributes

@@ -14924,6 +14924,7 @@ tests/webtbs/tw28718b.pp svneol=native#text/plain
 tests/webtbs/tw28718c.pp svneol=native#text/plain
 tests/webtbs/tw28718d.pp svneol=native#text/plain
 tests/webtbs/tw28748.pp svneol=native#text/plain
+tests/webtbs/tw28749.pp svneol=native#text/plain
 tests/webtbs/tw2876.pp svneol=native#text/plain
 tests/webtbs/tw28766.pp svneol=native#text/pascal
 tests/webtbs/tw28801.pp svneol=native#text/plain

+ 4 - 0
compiler/nadd.pas

@@ -437,6 +437,10 @@ implementation
              (lt in [pointerconstn,niln]) and
              (rt in [pointerconstn,niln]) and
              (nodetype in [ltn,lten,gtn,gten,equaln,unequaln,subn])
+            ) or
+            (
+             (lt = ordconstn) and (ld.typ = orddef) and is_currency(ld) and
+             (rt = ordconstn) and (rd.typ = orddef) and is_currency(rd)
             ) then
           begin
              t:=nil;

+ 14 - 0
tests/webtbs/tw28749.pp

@@ -0,0 +1,14 @@
+uses
+  SysUtils;
+var
+  s: string;
+  c: currency;
+begin
+  c:=Currency(0.12) + Currency(0.14);
+  s:=CurrToStr(c);
+  s:=StringReplace(s, FormatSettings.DecimalSeparator, '.', []);
+  writeln('s=', s);
+  if s <> '0.26' then
+    Halt(1);
+  writeln('OK');
+end.