Make this work on Unicode: var S: set of AnsiChar; begin S := ['a', 'b']; end;

This commit is contained in:
Martijn Laan 2024-05-12 09:07:48 +02:00
parent 7d888cda8c
commit f5638ff139

View File

@ -2746,6 +2746,15 @@ begin
end;
end;
function IsCharType(b: TPSBaseType): Boolean;
begin
case b of
btChar{$IFNDEF PS_NOWIDESTRING}, btWideChar{$ENDIF}: Result := True;
else
Result := False;
end;
end;
function IsRealType(b: TPSBaseType): Boolean;
begin
case b of
@ -6102,7 +6111,9 @@ function TPSPascalCompiler.ProcessSub(BlockInfo: TPSBlockInfo): Boolean;
for i := 0 to arr.count -1 do
begin
mType := GetTypeNo(BlockInfo, arr.Item[i]);
if (mType <> SetType.SetType) and not (IsIntType(mType.FBaseType) and IsIntType(SetType.SetType.BaseType)) then
if (mType <> SetType.SetType) and
not (IsIntType(mType.FBaseType) and IsIntType(SetType.SetType.BaseType)) and
not (IsCharType(mType.FBaseType) and IsCharType(SetType.SetType.BaseType)) then
begin
with MakeError('', ecTypeMismatch, '') do
begin