On Oct 19, 2025 at 10:27:50 PM, Martin Frb via fpc-devel <
[email protected]> wrote:

> Given an non-constrained param, then (in code) any member is assumed to
> be ok.
> But in declarations, members of the param can only be used if the
> compiler knows them.
>
>   generic TGenA<T1,T2> = class
>     X: T1;
>     Y: T2.unknown;
>   end;
>
> What reason may there be to reject the line for Y?
>

I agree the compiler can not know that T2.unknown is a valid member before
specializing so it should be valid syntax.

I think it's just a limitation in the parser. Ideally some subset of
typeless syntax should be allowed during the initial parse and only only
validated once the the type is specialized.
_______________________________________________
fpc-devel maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to