[fpc-devel] Generics: issue with double inline specialization
listbox at martoks-place.de
Mon Oct 24 21:01:52 CEST 2016
it appears we have been able to fix this issue. Please see the attached patch
and example program.
The problem is that when a specialization occurs as a resultdef, this symbol is
put into the local symtable. It is not previously present there, so a new one is
added. CheckDuplicate then finds a name collision from this symtable to the
parent symtable, where it was already defined via inheritance, raising a
Duplicate Identifier error.
The same happens when the same type specialization is used as a return type in
different classes, so it's not just this specific case.
The fix is to use the same logic as checkduplicate in FindWithHash for
tObjectSymtable and tLocalSymtable and also check parent symtables for
specialization names that are visible in the current context.
Before submitting this to the bugtracker, 3 questions: does this look sane in
general? We reuse internalerror 200602061 as this is raised for the exact same
error cause, is this style okay or should it get a fresh number? To transform
the example project into a testsuite test, what would be required?
Please let me know what you think,
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2042 bytes
Desc: not available
More information about the fpc-devel