In general, when getting strange internal errors that depend on order of compilation:

- reduce inline directives
- reduce unit import cycles.

Specially in combination with generics. This because both inline and generics somewhat live outside the normal "unit" system rules.

While these also matter for Delphi (though after XE that is somewhat reduced), these doubly go for FPC, which will try to inline generic methods in some cases, while Delphi doesn't even try as a rule.