The optimizer is removing the generic class
When compile the unit "ErrorUnit", the generic class used in this unit is removed from the output file, like the sample down:
unit ErrorUnit;
interface
uses ErrorUnit2;
procedure MakeError;
implementation
procedure MakeError;
var
List: specialize TMyClass<TObject>;
begin
List := specialize TMyClass<TObject>.Create;
List.Free;
end;
end.
unit ErrorUnit2;
interface
type
generic TMyClass<T> = class
end;
implementation
end.
The files were generated:
rtl.module("ErrorUnit",["System","ErrorUnit2"],function () {
"use strict";
var $mod = this;
this.MakeError = function () {
var List = null;
List = pas.ErrorUnit2.TMyClass$G1.$create("Create");
List = rtl.freeLoc(List);
};
});
rtl.module("ErrorUnit2",["System"],function () {
"use strict";
var $mod = this;
});