Delphi Compiler Error
E2515 Type parameter ‘%s’ is not compatible with type ‘%s’
Reason for the Error & Solution
This occurs when the type restraint object type is not a concrete type.
program E2515;
{$APPTYPE CONSOLE}
uses
SysUtils;
type
TMyConcreteClass = class
end;
type
TMyData<T: TMyConcreteClass> = class(TObject)
end;
var
mustBeConcreteType: TMyData<TObject>; //E2515 Fix: construct a class that wraps the TObject class and inherits its methods.
begin
Writeln('E2515 Type parameter ''%s'' is not compatible with type ''%s''');
end.