This commit is contained in:
Ivan Bondarev 2023-11-04 12:52:51 +01:00
parent fd2300c303
commit 5c4b3f1de4
3 changed files with 27 additions and 0 deletions

View file

@ -7614,6 +7614,7 @@ namespace PascalABCCompiler.NETGenerator
&& !(value.obj is ICommonConstructorCall) && !(value.obj is ICommonNamespaceFunctionCallNode)
&& !(value.obj is ICommonNestedInFunctionFunctionCallNode)
&& !(value.obj is IQuestionColonExpressionNode)
&& !(value.obj is IDoubleQuestionColonExpressionNode)
&& !(value.obj.conversion_type != null && !value.obj.conversion_type.is_value_type))
{
LocalBuilder lb = il.DeclareLocal(helper.GetTypeReference(value.obj.type).tp);

View file

@ -0,0 +1,17 @@
type
r1 = record
x: integer;
constructor(x: integer) := self.x := x;
end;
function f0 := new r1($12345678);
function f1(n: r1?) := (n??f0).Value;
begin
// Выводит 0 вместо 12345678
assert(f1(nil).x.ToString('X') = '12345678');
var rec: r1;
rec.x := 4;
assert(f1(rec).x.ToString('X') = '4');
end.

View file

@ -0,0 +1,9 @@

function f0 := $12345678;
function f1(n: integer?) := (n??f0).Value;
begin
// Выводит 0 вместо 12345678
assert(f1(nil).ToString('X') = '12345678');
end.