* correctly handle result type of string constant nodes for internally created

nodes

git-svn-id: trunk@45231 -
This commit is contained in:
florian 2020-05-03 12:41:17 +00:00
parent 4e92f2651e
commit b6097a0300
3 changed files with 25 additions and 2 deletions

1
.gitattributes vendored
View File

@ -13274,6 +13274,7 @@ tests/tbs/tb0668a.pp svneol=native#text/pascal
tests/tbs/tb0668b.pp svneol=native#text/pascal
tests/tbs/tb0669.pp svneol=native#text/pascal
tests/tbs/tb0670.pp svneol=native#text/pascal
tests/tbs/tb0671.pp svneol=native#text/pascal
tests/tbs/ub0060.pp svneol=native#text/plain
tests/tbs/ub0069.pp svneol=native#text/plain
tests/tbs/ub0119.pp svneol=native#text/plain

View File

@ -2972,12 +2972,14 @@ implementation
) then
begin
{ output string consts in local ansistring encoding }
if is_ansistring(resultdef) and ((tstringdef(resultdef).encoding=0)or(tstringdef(resultdef).encoding=globals.CP_NONE)) then
if is_ansistring(resultdef) and
{ do not mess with the result type for internally created nodes }
not(nf_internal in flags) and
((tstringdef(resultdef).encoding=0) or (tstringdef(resultdef).encoding=globals.CP_NONE)) then
tstringconstnode(left).changestringtype(getansistringdef)
else
tstringconstnode(left).changestringtype(resultdef);
result:=left;
resultdef:=left.resultdef;
left:=nil;
exit;
end

20
tests/tbs/tb0671.pp Normal file
View File

@ -0,0 +1,20 @@
{$inline on}
{$mode objfpc}{$H+}
resourcestring
rs = 'All files';
function fs: string;inline;
begin
Result:='*';
end;
function f: String;
begin
Result:=rs+' ('+fs+')|'+fs;
end;
begin
writeln(f);
end.