diff --git a/CodeCompletion/SymTable.cs b/CodeCompletion/SymTable.cs index 7e01c61fc..bf477a073 100644 --- a/CodeCompletion/SymTable.cs +++ b/CodeCompletion/SymTable.cs @@ -443,7 +443,8 @@ namespace CodeCompletion public void AddUsedUnit(SymScope unit) { - used_units.Add(unit); + if (!hasUsesCycle(unit)) + used_units.Add(unit); } public virtual string GetFullName() diff --git a/TestSuite/extensionmethods22.pas b/TestSuite/extensionmethods22.pas new file mode 100644 index 000000000..a1c076598 --- /dev/null +++ b/TestSuite/extensionmethods22.pas @@ -0,0 +1,13 @@ +type BallInfo = class + x: integer; +end; + +begin + var a : array of BallInfo; + a := new BallInfo[2](new BallInfo, new BallInfo); + var s := 0; + a[0].x := 1; + a[1].x := 2; + a.ForEach(x->begin s += x.x end); + assert(s = 3); +end. \ No newline at end of file diff --git a/TreeConverter/TreeRealization/types.cs b/TreeConverter/TreeRealization/types.cs index 306343e3a..3d64b32bf 100644 --- a/TreeConverter/TreeRealization/types.cs +++ b/TreeConverter/TreeRealization/types.cs @@ -1963,15 +1963,20 @@ namespace PascalABCCompiler.TreeRealization { return base_generic_instance.ConvertSymbolInfo(si); } - else if (si == null) + else //if (si == null) { if (ImplementingInterfaces != null) { foreach (type_node ii_tn in ImplementingInterfaces) { - si = ii_tn.find_in_type(name, CurrentScope); - if (si != null) - return si; + SymbolInfoList isi = ii_tn.find_in_type(name, CurrentScope); + if (isi != null) + { + if (si == null) + si = isi; + else + si.Add(isi); + } } } }