* fix for Mantis #34332: allow 2 parameter form of Copy also for ShortString variables

+ added test

git-svn-id: trunk@39802 -
This commit is contained in:
svenbarth 2018-09-25 19:10:06 +00:00
parent 0e6c072365
commit bf91991bae
3 changed files with 16 additions and 1 deletions

1
.gitattributes vendored
View File

@ -16252,6 +16252,7 @@ tests/webtbs/tw34239.pp svneol=native#text/pascal
tests/webtbs/tw34287.pp svneol=native#text/pascal
tests/webtbs/tw3429.pp svneol=native#text/plain
tests/webtbs/tw3433.pp svneol=native#text/plain
tests/webtbs/tw34332.pp svneol=native#text/pascal
tests/webtbs/tw3435.pp svneol=native#text/plain
tests/webtbs/tw3441.pp svneol=native#text/plain
tests/webtbs/tw3443.pp svneol=native#text/plain

View File

@ -1834,7 +1834,7 @@ implementation
begin
{ generic fallback that will give an error if a wrong
type is passed }
if (counter=3) then
if (counter=3) or (counter=2) then
resultdef:=cshortstringtype
else
CGMessagePos(ppn.left.fileinfo,type_e_mismatch);

14
tests/webtbs/tw34332.pp Normal file
View File

@ -0,0 +1,14 @@
{ %NORUN }
program tw34332;
{$mode objfpc}{$h+}
var
SS: ShortString;
S: String;
begin
SS := Copy(SS, 1); // << project1.lpr(9,14) Error: Type mismatch
S := Copy(S, 1); // << OK
SS := Copy(SS, 1, 1); // << OK
end.