mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 08:19:36 +01:00 
			
		
		
		
	* pgenutil.pas: factor out the reading of generic specialization parameters (parse_generic_specialization_types) and the generation of a generic type name (generate_generic_name)
* pdecsub.pas, parse_proc_head:
    * also allow an interface alias declaration if an identifier is followed by a "<" (which starts a specialization)
    + add a procedure "consume_generic_interface" which parses such a specialization (by using "parse_generic_specialization_types") - this is needed, because "consume_generic_type_parameter" can (and should not!) handle "ISomeIntf<Integer, T>" or (somewhen in the future) "ISomeIntf<TSomeOtherGeneric<T>>" - and finds the correct symbol for the interface (by utilizing the "generate_generic_name" function)
    * generate the correct mapping entry (for the generic it's only needed for checking (if any), but for a specialization it's essential that we reference the correct specialization)
+ add tests which were included with the issue and also two additional ones
Note: In non-Delphi modes an interface alias can be done like in Delphi mode; "specialization" is not necessary and furthermore not even allowed!
git-svn-id: trunk@21656 -
		
	
			
		
			
				
	
	
		
			28 lines
		
	
	
		
			542 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			542 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 IGenericIntf<LongInt>.SomeMethod = GenericIntf_SomeMethod;
 | 
						|
  end;
 | 
						|
 | 
						|
function TGenericClass.GenericIntf_SomeMethod: LongInt;
 | 
						|
begin
 | 
						|
end;
 | 
						|
 | 
						|
type
 | 
						|
  TGenericClassLongInt = specialize TGenericClass<String>;
 | 
						|
begin
 | 
						|
end.
 |