From 840c6637d0f86065464af5aa6b9280ada7a48fdc Mon Sep 17 00:00:00 2001 From: Ivan Bondarev Date: Sun, 27 Dec 2020 18:55:19 +0100 Subject: [PATCH] fix #2176 --- TestSuite/extensionoperators4.pas | 9 +++++++++ TreeConverter/TreeRealization/types.cs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 TestSuite/extensionoperators4.pas diff --git a/TestSuite/extensionoperators4.pas b/TestSuite/extensionoperators4.pas new file mode 100644 index 000000000..4e8c1701a --- /dev/null +++ b/TestSuite/extensionoperators4.pas @@ -0,0 +1,9 @@ +function operator=(a,b: array of T): boolean; extensionmethod := +(a.Length=b.Length) and a.SequenceEqual(b); + +begin + var a := Arr(1,2,3); + var b := Arr(1,2,3); + Assert(not object.ReferenceEquals(a,b)); + Assert(a = b); +end. \ No newline at end of file diff --git a/TreeConverter/TreeRealization/types.cs b/TreeConverter/TreeRealization/types.cs index a36fec435..2028d5e64 100644 --- a/TreeConverter/TreeRealization/types.cs +++ b/TreeConverter/TreeRealization/types.cs @@ -3456,7 +3456,7 @@ namespace PascalABCCompiler.TreeRealization List sil2 = find_in_additional_names(name); List sil3 = compiled_find(name); bool clone = false; - if (!no_search_in_extension_methods || this._compiled_type.IsGenericType) + if (!no_search_in_extension_methods || this._compiled_type.IsGenericType || this.type_special_kind == SemanticTree.type_special_kind.array_kind) { if (this.type_special_kind == SemanticTree.type_special_kind.array_kind && this.base_type.Scope != null)