[fpc-devel] Generics are still broken
Anthony Walter
sysrpl at gmail.com
Fri May 11 20:10:41 CEST 2012
Okay with the latest trunk version I tried compiling my generic classes. It
seems there is a problem with fpc generics in that you cannot use a generic
as a type parameter. e.g type TDictionary<K,V> =
class(TEnumerable<TPair<K,V>>) ...
Given:
type
TCollection<T> = class
end;
TPair<K,V> = class
Key: K;
Value: V;
end;
// Test
var
TestA: TCollection<TPair<String,Integer>>; // Fatal: Syntax error, ","
expected but "<" found
TestB: TCollection<String>; // Okay
The same problem occurs with classes
type
TDictionaryA<K,V> = class(TCollection<TPair<K,V>>) // Fatal: Syntax
error, "," expected but "<" found
end;
TDictionaryB<K,V> = class(TCollection<Integer>) // Okay
end;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20120511/ee29ddf3/attachment.html>
More information about the fpc-devel
mailing list