[fpc-pascal] Two possible generics bugs
Ryan Joseph
genericptr at gmail.com
Fri Nov 29 22:56:54 CET 2019
> On Nov 29, 2019, at 2:00 AM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>
> Why? It does say that a class type is expected. And the column of the error should point to the correct location.
> That's the same error you'd get when specializing outside of a generic with a non-class type.
I think you're right, my fault for not looking at the column close enough.
>
>
> > The "specialize" is part of the generic identifier, so it must be "FGL.specialize TFPGObjectList<T>".
> >
> > That said however an internal error should not happen (especially the one I just added some days ago ^^'). Please report this one.
> >
>
> That doesn't look right to my eyes but ok. I filed a report (https://bugs.freepascal.org/view.php?id=36377).
>
> The idea is that "specialize" belongs to the identifier just like "generic" does. This comes especially apparent for nested specializations:
>
> SomeUnit.specialize SomeType<... >.specialize SomeFunc<... >
What's your plan to make an implicit specialize modeswitch? I remember you said you wanted to and it sounds like low-hanging fruit I could maybe help with. The specialize keyword is a bit much in my opinion and it sounds like it could be omitted like Delphi mode does.
>
> begin
> a := TNodeObjectList.Create;
> // EListError: Incompatible item size in source list
> b := CopyList(a) as TNodeObjectList;
> end.
>
> Can't tell right now from looking at it. Will need to test that later on.
>
Anyone else have any idea? Doesn't make any sense to me.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list