[fpc-pascal] Supports() only checks declared interfaces?

Michalis Kamburelis michalis.kambi at gmail.com
Thu Jan 6 14:14:46 CET 2011


Hi,

Consider the attached source code. I have a base interface (IA) and a
descendant interface (IB). Class TB is declared as

  TB = class(TInterfacedObject, IB) end;

Now I would expect that both

  Supports(TB, IA)
  Supports(TB, IB)

return true. After all, TB is forced to implement methods of both IA and
IB, as IB descends from IA. But to my surprise, Supports(TB, IA) returns
false.

Changing the declaration to

  TB = class(TInterfacedObject, IA, IB) end;

workarounds the problem (Supports(TB, IA) returns true), but seems
strange in my opinion.

I haven't found any explanation for this e.g. in docs
(http://freepascal.org/docs-html/rtl/sysutils/supports.html ,
http://freepascal.org/docs-html/ref/refch7.html ).

Is this the expected behavior? Documented anywhere? Or is this a bug,
and I should submit it?

Thanks,
Michalis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.pas
Type: text/x-pascal
Size: 451 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110106/83fa1109/attachment.pas>


More information about the fpc-pascal mailing list