Function in a generic class cannot return an object of the class
Original Reporter info from Mantis: Azarien
-
Reporter name: Wiktor Sywula
Original Reporter info from Mantis: Azarien
- Reporter name: Wiktor Sywula
Description:
It should be possible for a method to have a return type of the specialized class that it belongs to.
type generic TGenericType<T>=class
function ReturnSelf:specialize TGenericType<T>;
end;
type generic TGenericType<T>=class
type ST=specialize TGenericType<T>;
function ReturnSelf:ST;
end;
The first example gives a non-sense error message:
genbugs.pas(7,57) Fatal: Syntax error, "<" expected but "<" found
The second one gives Illegal expression.
Steps to reproduce:
Compile the attached file.
Mantis conversion info:
- Mantis ID: 15875
- Version: 2.4.0
- Fixed in version: 2.6.0
- Fixed in revision: 16438 (#675c3391)
- Monitored by: » alexionne (Aleksa Todorovic)