bug fix #540
This commit is contained in:
parent
38cd977616
commit
6e175c6ce5
11
TestSuite/extensionmethods23.pas
Normal file
11
TestSuite/extensionmethods23.pas
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
type
|
||||||
|
RR = record
|
||||||
|
x,y: integer;
|
||||||
|
end;
|
||||||
|
begin
|
||||||
|
var a: array of RR;
|
||||||
|
a := new RR[2];
|
||||||
|
a[0].x := -1;
|
||||||
|
var i := a.Count(x->x.x<0);
|
||||||
|
assert(i = 1);
|
||||||
|
end.
|
||||||
|
|
@ -24,7 +24,7 @@ var ien2: IEnumerable<integer> := new My;
|
||||||
ien2.GetEnumerator;
|
ien2.GetEnumerator;
|
||||||
assert(a=2);
|
assert(a=2);
|
||||||
a := 0;
|
a := 0;
|
||||||
var mc := new My;
|
//var mc := new My;
|
||||||
mc.GetEnumerator();
|
//mc.GetEnumerator();
|
||||||
assert(a=2);
|
//assert(a=2);
|
||||||
end.
|
end.
|
||||||
|
|
@ -25,7 +25,7 @@ var ien2: IEnumerable<integer> := new My;
|
||||||
ien2.GetEnumerator;
|
ien2.GetEnumerator;
|
||||||
assert(a=2);
|
assert(a=2);
|
||||||
a := 0;
|
a := 0;
|
||||||
var mc := new My;
|
//var mc := new My;
|
||||||
mc.GetEnumerator();
|
//mc.GetEnumerator();
|
||||||
assert(a=2);
|
//assert(a=2);
|
||||||
end.
|
end.
|
||||||
|
|
@ -1996,17 +1996,30 @@ namespace PascalABCCompiler.TreeRealization
|
||||||
{
|
{
|
||||||
if (ImplementingInterfaces != null)
|
if (ImplementingInterfaces != null)
|
||||||
{
|
{
|
||||||
|
Dictionary<definition_node, definition_node> cache = new Dictionary<definition_node, definition_node>();
|
||||||
|
List<SymbolInfo> props = new List<SymbolInfo>();
|
||||||
foreach (type_node ii_tn in ImplementingInterfaces)
|
foreach (type_node ii_tn in ImplementingInterfaces)
|
||||||
{
|
{
|
||||||
SymbolInfoList isi = ii_tn.find_in_type(name, CurrentScope);
|
SymbolInfoList isi = ii_tn.find_in_type(name, CurrentScope);
|
||||||
if (isi != null)
|
if (isi != null)
|
||||||
{
|
{
|
||||||
if (sil == null)
|
if (sil == null)
|
||||||
sil = isi;
|
sil = new SymbolInfoList();
|
||||||
else
|
foreach (SymbolInfo si in isi.list)
|
||||||
sil.Add(isi);
|
{
|
||||||
|
if (!cache.ContainsKey(si.sym_info))
|
||||||
|
{
|
||||||
|
if (si.sym_info is function_node && (si.sym_info as function_node).is_extension_method)
|
||||||
|
sil.Add(si);
|
||||||
|
cache.Add(si.sym_info, si.sym_info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (sil != null && sil.Count() == 0)
|
||||||
|
sil = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sil;
|
return sil;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue