Pārlūkot izejas kodu

Fix for Mantis #26482.

pgenutil.pas, generate_specialization:
  * also search for the generic type in general if it was previously found in a record/class as there might be a non-generic type (or one with a different number of parameters) defined elsewhere

+ added test

git-svn-id: trunk@28244 -
svenbarth 11 gadi atpakaļ
vecāks
revīzija
856ae9d3cf
3 mainītis faili ar 28 papildinājumiem un 0 dzēšanām
  1. 1 0
      .gitattributes
  2. 2 0
      compiler/pgenutil.pas
  3. 25 0
      tests/webtbs/tw26482.pp

+ 1 - 0
.gitattributes

@@ -14000,6 +14000,7 @@ tests/webtbs/tw26408.pp svneol=native#text/pascal
 tests/webtbs/tw2643.pp svneol=native#text/plain
 tests/webtbs/tw2645.pp svneol=native#text/plain
 tests/webtbs/tw2647.pp svneol=native#text/plain
+tests/webtbs/tw26482.pp svneol=native#text/pascal
 tests/webtbs/tw2649.pp svneol=native#text/plain
 tests/webtbs/tw2651.pp svneol=native#text/plain
 tests/webtbs/tw2656.pp svneol=native#text/plain

+ 2 - 0
compiler/pgenutil.pas

@@ -590,6 +590,8 @@ uses
               found:=searchsym_in_class(tobjectdef(genericdef.owner.defowner),tobjectdef(genericdef.owner.defowner),ugenname,srsym,st,[])
             else
               found:=searchsym_in_record(tabstractrecorddef(genericdef.owner.defowner),ugenname,srsym,st);
+            if not found then
+              found:=searchsym(ugenname,srsym,st);
           end
         else
           found:=searchsym(ugenname,srsym,st);

+ 25 - 0
tests/webtbs/tw26482.pp

@@ -0,0 +1,25 @@
+unit tw26482;
+
+{$mode delphi}
+
+interface
+
+type
+  TEnumerator<T> = class
+  end;
+
+  TList<T> = class
+  public
+    type
+      TEnumerator = class(TObject);
+  protected
+    function DoGetEnumerator: TEnumerator<T>;
+  end;
+
+implementation
+
+function TList<T>.DoGetEnumerator: TEnumerator<T>; // Error: Identifier not found "TEnumerator$1"
+begin
+end;
+
+end.