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)