Pārlūkot izejas kodu

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 -
svenbarth 11 gadi atpakaļ
vecāks
revīzija
244ac12794
3 mainītis faili ar 31 papildinājumiem un 1 dzēšanām
  1. 1 0
      .gitattributes
  2. 1 1
      compiler/htypechk.pas
  3. 29 0
      tests/webtbs/tw26615.pp

+ 1 - 0
.gitattributes

@@ -14067,6 +14067,7 @@ tests/webtbs/tw2649.pp svneol=native#text/plain
 tests/webtbs/tw2651.pp svneol=native#text/plain
 tests/webtbs/tw2651.pp svneol=native#text/plain
 tests/webtbs/tw2656.pp svneol=native#text/plain
 tests/webtbs/tw2656.pp svneol=native#text/plain
 tests/webtbs/tw2659.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/tw26627.pp -text svneol=native#text/plain
 tests/webtbs/tw2666.pp svneol=native#text/plain
 tests/webtbs/tw2666.pp svneol=native#text/plain
 tests/webtbs/tw2668.pp svneol=native#text/plain
 tests/webtbs/tw2668.pp svneol=native#text/plain

+ 1 - 1
compiler/htypechk.pas

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

+ 29 - 0
tests/webtbs/tw26615.pp

@@ -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.