* fixed evaluation of length('') (the type of an empty string is a chararray

instead of string) (mantis #17604)

git-svn-id: trunk@16128 -
This commit is contained in:
Jonas Maebe 2010-10-11 15:00:20 +00:00
parent 2139a229d3
commit a178ff5172
3 changed files with 12 additions and 1 deletions

1
.gitattributes vendored
View File

@ -10701,6 +10701,7 @@ tests/webtbs/tw1754c.pp svneol=native#text/plain
tests/webtbs/tw1755.pp svneol=native#text/plain
tests/webtbs/tw17550.pp svneol=native#text/plain
tests/webtbs/tw1758.pp svneol=native#text/plain
tests/webtbs/tw17604.pp svneol=native#text/plain
tests/webtbs/tw1765.pp svneol=native#text/plain
tests/webtbs/tw1779.pp svneol=native#text/plain
tests/webtbs/tw1780.pp svneol=native#text/plain

View File

@ -1711,7 +1711,12 @@ implementation
end;
arraydef :
begin
if not is_open_array(left.resultdef) and
if (left.nodetype=stringconstn) then
begin
result:=cordconstnode.create(
tstringconstnode(left).len,sinttype,true);
end
else if not is_open_array(left.resultdef) and
not is_array_of_const(left.resultdef) and
not is_dynamic_array(left.resultdef) then
result:=cordconstnode.create(tarraydef(left.resultdef).highrange-

5
tests/webtbs/tw17604.pp Normal file
View File

@ -0,0 +1,5 @@
program TestLength;
begin
if Length('') <> 0 then
halt(1);
end.