fix #1972
This commit is contained in:
parent
599d8387ed
commit
134c984e29
|
|
@ -1,4 +1,4 @@
|
|||
|
||||
|
||||
type TRec = record
|
||||
a : object;
|
||||
arr : array of object;
|
||||
|
|
@ -17,5 +17,6 @@ var v : object := nil;
|
|||
rec2 : TRec:=(a:nil;arr:(nil,nil));
|
||||
|
||||
begin
|
||||
|
||||
assert(arr4[2] = nil);
|
||||
assert(rec2.a = nil);
|
||||
end.
|
||||
12
TestSuite/nil2.pas
Normal file
12
TestSuite/nil2.pas
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
begin
|
||||
var s1 := Seq('abc','def');
|
||||
var s2 := s1 + string(nil); //Вызывает это: function operator+<T>(a, b: sequence of T): sequence of T; extensionmethod;
|
||||
assert(s2.ToArray[2] = nil);
|
||||
var i := 0;
|
||||
try
|
||||
var s3 := s1 + nil;
|
||||
except
|
||||
i := 1;
|
||||
end;
|
||||
assert(i = 1);
|
||||
end.
|
||||
|
|
@ -669,7 +669,8 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
return from;
|
||||
}
|
||||
|
||||
|
||||
|
||||
possible_type_convertions ptc = type_table.get_convertions(from.type, to, false);
|
||||
if (ptc.second != null)
|
||||
{
|
||||
|
|
@ -687,7 +688,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
ret.conversion_type = conv_type;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
if ((type_table.is_derived(from.type, to)) || (type_table.is_derived(to, from.type)) || from.type.IsInterface || to.IsInterface && !(from.type is delegated_methods))
|
||||
{
|
||||
if (from.type.IsSealed && to.IsInterface && !from.type.ImplementingInterfaces.Contains(to) ||
|
||||
|
|
|
|||
|
|
@ -1087,7 +1087,8 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
if ( !type_table.is_with_nil_allowed(left.type) && !left.type.IsPointer)
|
||||
AddError(right.location, "NIL_WITH_VALUE_TYPES_NOT_ALLOWED");
|
||||
right = null_const_node.get_const_node_with_type(left.type, (null_const_node)right);
|
||||
if (right.conversion_type == null)
|
||||
right = null_const_node.get_const_node_with_type(left.type, (null_const_node)right);
|
||||
}
|
||||
|
||||
/*if (left.semantic_node_type == semantic_node_type.null_const_node)
|
||||
|
|
|
|||
Loading…
Reference in a new issue