Generic Constraint does not accept a Pre-Declared Class.
Original Reporter info from Mantis: Raid
-
Reporter name: Dennis Fehr
Original Reporter info from Mantis: Raid
- Reporter name: Dennis Fehr
Description:
I worked around the issue by defining a Class Type, but it would be nice if it could be fixed (though, not sure how it would be implemented, as it wouldn't know the type at that point yet..) Not sure if we'd have to add a Type Hint for predeclared Classes or not.. Or even allow it at all. Does it work in Delphi? I don't have Delphi so I can't test.
Steps to reproduce:
This does not work:
----------
TSomeList&LtPos;T : TObject> = Class
End; { Class }
TSomeClass = Class;
TSomeClassList = TSomeList&LtPos;TSomeClass>;
TSomeClass = Class(TObject)
SomeList : TSomeClassList;
End;
-----------------------------
However, this does:
-----------------------------
TSomeList&LtPos;T : TObject> = Class
End; { Class }
TSomeClass = Class(TObject)
// Now can't reference TSomeClass in here :(
End;
TSomeClassList = TSomeList&LtPos;TSomeClass>;
-----------------------
Mantis conversion info:
- Mantis ID: 26599
- Version: 2.7.1
- Fixed in version: 3.0.0
- Fixed in revision: 28601 (#684c8842)