This commit is contained in:
Ivan Bondarev 2024-08-13 10:40:23 +02:00
parent 0d846d2335
commit d396c4a9fe
2 changed files with 8 additions and 1 deletions

6
TestSuite/nullable18.pas Normal file
View file

@ -0,0 +1,6 @@
begin
var a := |default(integer?),nil,1|;
assert(a[1] = nil);
assert(a[0] = nil);
assert(a[2] = 1);
end.

View file

@ -3285,7 +3285,8 @@ namespace PascalABCCompiler.TreeConverter
ret_type = types[i];
else if (tc == type_compare.non_comparable_type)
{
AddError(lst[i].location, "UNCOMPARABLE_TYPES_IN_ARRAY_CONST");
if (!can_convert_type(types[i], ret_type))
AddError(lst[i].location, "UNCOMPARABLE_TYPES_IN_ARRAY_CONST");
}
}