mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 17:47:56 +02:00

* 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 -
28 lines
553 B
ObjectPascal
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.
|