当我尝试在类中使用数组常量时,出现以下错误:
[dcc32 Error] TestConstants.dpr(14): E2086 Type 'TArray<T>' is not yet completely defined
当我将其用作全局常量或使用array of string
而不是TArray时,相同的代码可以很好地编译。使这个工作有效吗?
program Project98;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
type
TMyTestClass = class
strict private
const
TEST_CLASS_CONSTANT: TArray<String> = ['1','2']; // <-- Error here
TEST_CLASS_CONSTANT2: array of string = ['1','2']; // <-- No error
end;
const
TEST_GLOABL_CONSTANT: TArray<String> = ['3','4']; // <-- No error
TEST_GLOBAL_CONSTANT2: array of string = ['3','4']; // <-- No error
begin
end.