mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-20 20:59:29 +01:00
* prefer shortstring to ansistring over ansistring to shortstring
* don't prefer widestring to short/ansistring git-svn-id: trunk@594 -
This commit is contained in:
parent
f2f968f48a
commit
86bf41f689
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -6134,6 +6134,7 @@ tests/webtbs/tw4140.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw4150.pp svneol=native#text/plain
|
tests/webtbs/tw4150.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw4151.pp svneol=native#text/plain
|
tests/webtbs/tw4151.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw4152.pp svneol=native#text/plain
|
tests/webtbs/tw4152.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw4162.pp svneol=native#text/plain
|
||||||
tests/webtbs/ub1873.pp svneol=native#text/plain
|
tests/webtbs/ub1873.pp svneol=native#text/plain
|
||||||
tests/webtbs/ub1883.pp svneol=native#text/plain
|
tests/webtbs/ub1883.pp svneol=native#text/plain
|
||||||
tests/webtbs/uw0555.pp svneol=native#text/plain
|
tests/webtbs/uw0555.pp svneol=native#text/plain
|
||||||
|
|||||||
@ -304,12 +304,23 @@ implementation
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
doconv:=tc_string_2_string;
|
doconv:=tc_string_2_string;
|
||||||
{ Prefer conversions to shortstring over other
|
if tstringdef(def_from).string_typ=st_widestring then
|
||||||
conversions. This is compatible with Delphi (PFV) }
|
begin
|
||||||
if tstringdef(def_to).string_typ=st_shortstring then
|
{ Prefer conversions to shortstring over other
|
||||||
eq:=te_convert_l2
|
conversions. This is compatible with Delphi (PFV) }
|
||||||
|
if tstringdef(def_to).string_typ=st_shortstring then
|
||||||
|
eq:=te_convert_l3
|
||||||
|
else
|
||||||
|
eq:=te_convert_l2;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
eq:=te_convert_l3;
|
{ Prefer shortstrings of different length or conversions
|
||||||
|
from shortstring to ansistring }
|
||||||
|
if (tstringdef(def_from).string_typ=st_shortstring) and
|
||||||
|
(tstringdef(def_to).string_typ in [st_shortstring,st_ansistring]) then
|
||||||
|
eq:=te_convert_l1
|
||||||
|
else
|
||||||
|
eq:=te_convert_l2;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
orddef :
|
orddef :
|
||||||
|
|||||||
12
tests/webtbs/tw4162.pp
Normal file
12
tests/webtbs/tw4162.pp
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
Var
|
||||||
|
S: ansistring;
|
||||||
|
SS: shortstring;
|
||||||
|
Begin
|
||||||
|
SS := 'find';
|
||||||
|
SetLength(S, 300);
|
||||||
|
S := S + SS;
|
||||||
|
Writeln(Pos(SS, S)); // This will not find the occurance of 'find'
|
||||||
|
if pos(ss,s)<>301 then
|
||||||
|
halt(1);
|
||||||
|
End.
|
||||||
Loading…
Reference in New Issue
Block a user