Fix for Mantis #26615.

htypechk.pas, tcallcandidates:
  * collect_overloads_in_struct: we need to check the deftyp of the extended def for record- or objectdef, not the deftyp of the helper which will always be objectdef anyway.

+ added test

git-svn-id: trunk@28572 -
This commit is contained in:
svenbarth 2014-09-01 07:18:02 +00:00
parent 74e56c2674
commit 244ac12794
3 changed files with 31 additions and 1 deletions

1
.gitattributes vendored
View File

@ -14067,6 +14067,7 @@ tests/webtbs/tw2649.pp svneol=native#text/plain
tests/webtbs/tw2651.pp svneol=native#text/plain
tests/webtbs/tw2656.pp svneol=native#text/plain
tests/webtbs/tw2659.pp svneol=native#text/plain
tests/webtbs/tw26615.pp svneol=native#text/pascal
tests/webtbs/tw26627.pp -text svneol=native#text/plain
tests/webtbs/tw2666.pp svneol=native#text/plain
tests/webtbs/tw2668.pp svneol=native#text/plain

View File

@ -2227,7 +2227,7 @@ implementation
break;
end;
if is_objectpascal_helper(structdef) and
(tobjectdef(structdef).typ in [recorddef,objectdef]) then
(tobjectdef(structdef).extendeddef.typ in [recorddef,objectdef]) then
begin
{ search methods in the extended type as well }
srsym:=tprocsym(tabstractrecorddef(tobjectdef(structdef).extendeddef).symtable.FindWithHash(hashedid));

29
tests/webtbs/tw26615.pp Normal file
View File

@ -0,0 +1,29 @@
{ %NORUN }
program tw26615;
{$MODE OBJFPC}{$H+}
{$MODESWITCH TYPEHELPERS}
uses
sysutils;
type
TStringHelper = type helper for UnicodeString
class function Cr(AStr: UnicodeString): UnicodeString; static; overload;
end;
class function TStringHelper.Cr(AStr: UnicodeString): UnicodeString;
begin
Result := '#'+AStr;
end;
var
us: UnicodeString;
begin
us := UnicodeString.Cr('a');
writeln(us);
end.