* explicitly check for stringconstn next to stringdef in nadd, because

a stringconstn is often an arraydef. The result is that they again
    get the same typeconversion behaviour as string variables, which is
    important in case of overloaded operators (#9021/#9026)

git-svn-id: trunk@8268 -
This commit is contained in:
Jonas Maebe 2007-08-12 11:31:19 +00:00
parent abd3ce841a
commit 3f701c96d4
3 changed files with 32 additions and 0 deletions

1
.gitattributes vendored
View File

@ -8341,6 +8341,7 @@ tests/webtbs/tw8950.pp svneol=native#text/plain
tests/webtbs/tw8975.pp svneol=native#text/plain
tests/webtbs/tw8975a.pp svneol=native#text/plain
tests/webtbs/tw8977.pp svneol=native#text/plain
tests/webtbs/tw9026.pp svneol=native#text/plain
tests/webtbs/tw9054.pp svneol=native#text/plain
tests/webtbs/tw9059.pp svneol=native#text/plain
tests/webtbs/tw9073.pp svneol=native#text/plain

View File

@ -1314,6 +1314,9 @@ implementation
pchar is converted to string }
else if (rd.typ=stringdef) or
(ld.typ=stringdef) or
{ stringconstn's can be arraydefs }
(lt=stringconstn) or
(rt=stringconstn) or
((is_pchar(rd) or is_chararray(rd) or is_char(rd) or is_open_chararray(rd) or
is_pwidechar(rd) or is_widechararray(rd) or is_widechar(rd) or is_open_widechararray(rd)) and
(is_pchar(ld) or is_chararray(ld) or is_char(ld) or is_open_chararray(ld) or

28
tests/webtbs/tw9026.pp Normal file
View File

@ -0,0 +1,28 @@
operator := (input:extended) output: string;
begin
str(round(input),output);
end;
operator + (const s: string; input:extended) output: string;
begin
str(round(input),output);
output:=s+output;
end;
procedure test(a:string);
begin
writeln(a);
if (a <> 'help1') then
halt(1);
end;
var
s: string;
begin
s:='help';
test('help'+1);
test(s+1);
test(s+1.2);
test(s+extended(1.2));
test(s+string(1.2));
end.