From 15cd6f0bd086d27bb43b0996d1d3ec8adaedc7f9 Mon Sep 17 00:00:00 2001 From: Ivan Bondarev Date: Sun, 25 Dec 2022 11:38:45 +0100 Subject: [PATCH] #2759 --- NETGenerator/NETGenerator.cs | 2 +- TestSuite/with4.pas | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 TestSuite/with4.pas diff --git a/NETGenerator/NETGenerator.cs b/NETGenerator/NETGenerator.cs index 69f7287f8..8f2e605ed 100644 --- a/NETGenerator/NETGenerator.cs +++ b/NETGenerator/NETGenerator.cs @@ -8170,7 +8170,7 @@ namespace PascalABCCompiler.NETGenerator //Массив присваиваем массиву=>надо вызвать копирование TypeInfo ti_l = helper.GetTypeReference(to.type); TypeInfo ti_r = helper.GetTypeReference(from.type); - if (ti_l.is_arr && ti_r.is_arr) + if (ti_l.is_arr && ti_r.is_arr && !(to is ILocalBlockVariableReferenceNode && (to as ILocalBlockVariableReferenceNode).Variable.name.StartsWith("$TV"))) { il.Emit(OpCodes.Call, ti_r.clone_meth); } diff --git a/TestSuite/with4.pas b/TestSuite/with4.pas new file mode 100644 index 000000000..899aa5111 --- /dev/null +++ b/TestSuite/with4.pas @@ -0,0 +1,14 @@ + type + TRec = record + b: integer; + end; + +begin + var a: array [0..1,0..1] of TRec; + with a[0,0] do + begin + b := 2; + end; + + assert(a[0,0].b = 2); +end. \ No newline at end of file