<div dir="auto"><div><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">Martin Frb via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> schrieb am Mo., 24. Nov. 2025, 21:30:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Normally, if I refer to a type then the first type found by the name <br>
will be taken => and if that type is not compatible, then I get an error.<br>
=> See Example 2<br>
<br>
But, if I try to specialize a generic, and some other type by the same <br>
name exists, and comes first in the search order, then it will be ignored.<br>
<br>
The specialize below, ignores the "TFoo = class"  which can not be used, <br>
and finds the TFoo from unit1.<br>
<br>
Is that intended?<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Yes, because in fact they don't have the same name. The name of a generic with a single parameter is essentially "TFoo<>" while that of a generic with two parameters is "TFoo<,>". </div><div dir="auto"><br></div><div dir="auto">The amount of generic parameters is part of the type or routine name.</div><div dir="auto"><br></div><div dir="auto">Note: non-Delphi modes currently don't allow type overloading in the same unit, but it's on my ToDo-list to make it possible there as well, but it requires some adjustments to allow compatibility to existing code which is why it's not possible yet. </div><div dir="auto"><br></div><div dir="auto">Regards, </div><div dir="auto">Sven </div></div>