This commit is contained in:
parent
6e041d36c9
commit
7f6030c253
|
|
@ -8058,7 +8058,7 @@ namespace PascalABCCompiler.NETGenerator
|
|||
(ctn2 != null && (ctn2.compiled_type == TypeFactory.ObjectType || ctn2.compiled_type == TypeFactory.EnumType) || tn2.IsInterface) && !(real_parameters[i] is SemanticTree.INullConstantNode)
|
||||
&& (ctn3.is_value_type || ctn3.is_generic_parameter);
|
||||
if (!box_awaited && (ctn2 != null && ctn2.compiled_type == TypeFactory.ObjectType || tn2.IsInterface) && !(real_parameters[i] is SemanticTree.INullConstantNode)
|
||||
&& ctn4 != null && ctn4.is_value_type)
|
||||
&& ctn4 != null && (ctn4.is_value_type || ctn4.is_generic_parameter))
|
||||
{
|
||||
box_awaited = true;
|
||||
use_stn4 = true;
|
||||
|
|
|
|||
16
TestSuite/generics70.pas
Normal file
16
TestSuite/generics70.pas
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
var i: integer;
|
||||
|
||||
procedure p0(o: object);
|
||||
begin
|
||||
i := integer(o);
|
||||
end;
|
||||
|
||||
procedure p1<T>(a: T);
|
||||
begin
|
||||
p0(object(a));
|
||||
end;
|
||||
|
||||
begin
|
||||
p1(1);
|
||||
assert(i = 1);
|
||||
end.
|
||||
13
TestSuite/generics71.pas
Normal file
13
TestSuite/generics71.pas
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
var InputList := new List<object>;
|
||||
|
||||
procedure GenerateTests<T>(a: array of T);
|
||||
begin
|
||||
InputList.Add(object(a[0]));
|
||||
Print(1);
|
||||
end;
|
||||
|
||||
begin
|
||||
GenerateTests(Arr('a','b'));
|
||||
Print(InputList);
|
||||
assert(char(InputList[0]) = 'a');
|
||||
end.
|
||||
Loading…
Reference in a new issue