A non-generic class could not inherit from a generic-class instance:
TBox<T> = class ... end;
TIntBox = class(TBox<Integer>) ... end; // rejected, then bad IR
Two bugs:
1. Semantic: AnalyseTypeDecls assumed any generic name in the first
heritage slot was an interface — it cast FindTypeOrInstantiate's
result to TInterfaceTypeDesc and moved it to the implements list, so a
generic CLASS parent was rejected as "Unknown interface 'TBox<Integer>'
in implements list". It now classifies the instantiated descriptor: a
tyInterface result is an implements entry, anything else stays as the
parent class for normal class-parent resolution.
2. QBE codegen: the inheriting class's typeinfo referenced its parent as
$typeinfo_TBox<Integer> via ClassSymName (which does not mangle <>),
but the generic instance's typeinfo is defined under the QBEMangle'd
symbol $typeinfo_TBox_Integer — producing invalid QBE IR ("invalid
character <"). The parent reference now uses QBEMangle for a generic
instance, matching its definition. The native backend already mangled
correctly and only needed the semantic fix.
Verified inherited method + field access and a virtual method declared on
the generic base and overridden in the derived class, on both backends.
Adds TE2EGenericsTests.TestRun_InheritFromGenericInstance_{MethodAndField,
VirtualOverride} and a note in docs/language-rationale.adoc.