fpc/tests/test/tgeneric79.pp
svenbarth 17a0ac7fc0 pdecsub.pas:
* extend parse_proc_head() with support for /parsing/ generic functions (at least in mode Delphi, mode ObjFPC depends on the new isgeneric parameter to be set)
  * adjust parsing of interface mappings with a generic interface (note: in mode ObjFPC this now requires a "specialize" directly before the generic interface's name, which is more in line with other uses of "specialize")
pexpr.pas, factor:
  * don't call postfixoperators() if hadspecialize is set

tests/test/tgeneric79.pp:
  * adjust test to changed syntax

git-svn-id: trunk@31769 -
2015-09-18 16:24:07 +00:00

28 lines
553 B
ObjectPascal

{ %NORUN }
{ additional test based on 21064 }
program tgeneric79;
{$mode objfpc}
type
generic IGenericIntf<T> = interface
function SomeMethod: T;
end;
generic TGenericClass<T> = class(TInterfacedObject, specialize IGenericIntf<LongInt>)
private
protected
function GenericIntf_SomeMethod: LongInt;
function specialize IGenericIntf<LongInt>.SomeMethod = GenericIntf_SomeMethod;
end;
function TGenericClass.GenericIntf_SomeMethod: LongInt;
begin
end;
type
TGenericClassLongInt = specialize TGenericClass<String>;
begin
end.