* compare constant sets correctly while choosing an overloaded procedure, resolves #11288

git-svn-id: trunk@10957 -
This commit is contained in:
florian 2008-05-12 12:45:55 +00:00
parent 063af15a0c
commit 8306eb4753
3 changed files with 37 additions and 0 deletions

1
.gitattributes vendored
View File

@ -8202,6 +8202,7 @@ tests/webtbs/tw1123.pp svneol=native#text/plain
tests/webtbs/tw1124.pp svneol=native#text/plain
tests/webtbs/tw11254.pp svneol=native#text/plain
tests/webtbs/tw11255.pp svneol=native#text/plain
tests/webtbs/tw11288.pp svneol=native#text/plain
tests/webtbs/tw1132.pp svneol=native#text/plain
tests/webtbs/tw1133.pp svneol=native#text/plain
tests/webtbs/tw1152.pp svneol=native#text/plain

View File

@ -1952,6 +1952,7 @@ implementation
pdoper : tprocdef;
releasecurrpt : boolean;
cdoptions : tcompare_defs_options;
n : tnode;
{$ifopt r+}{$define ena_r}{$r-}{$endif}
{$ifopt q+}{$define ena_q}{$q-}{$endif}
@ -2111,6 +2112,17 @@ implementation
objdef:=objdef.childof;
end;
end
{ compare_defs_ext compares sets and array constructors very poorly because
it has too little information. So we do explicitly a detailed comparisation,
see also bug #11288 (FK)
}
else if (def_to.typ=setdef) and is_array_constructor(currpt.left.resultdef) then
begin
n:=currpt.left.getcopy;
arrayconstructor_to_set(n);
eq:=compare_defs_ext(n.resultdef,def_to,n.nodetype,convtype,pdoper,cdoptions);
n.free;
end
else
{ generic type comparision }
begin

24
tests/webtbs/tw11288.pp Normal file
View File

@ -0,0 +1,24 @@
program project1;
{$mode delphi}
type
TEnum1 = (en1, en2);
TEnum2 = (en3, en4);
TSet1 = set of TEnum1;
TSet2 = set of TEnum2;
procedure DoSomethingWithSet(ASet: TSet1); overload;
begin
end;
procedure DoSomethingWithSet(ASet: TSet2); overload;
begin
end;
begin
DoSomethingWithSet([en1]);
end.