bug fix #2179
This commit is contained in:
parent
e7213b9c8d
commit
b733440a4e
30
TestSuite/extensionmethods33.pas
Normal file
30
TestSuite/extensionmethods33.pas
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
uses System.Windows.Forms;
|
||||
{$reference System.Windows.Forms.dll}
|
||||
|
||||
var i: integer;
|
||||
|
||||
procedure p1(self: Control); extensionmethod;
|
||||
begin
|
||||
Inc(i);
|
||||
end;
|
||||
|
||||
type
|
||||
|
||||
t1 = abstract class(Panel)
|
||||
|
||||
end;
|
||||
|
||||
t2 = sealed class(t1)
|
||||
|
||||
constructor;
|
||||
begin
|
||||
t1(self).p1;
|
||||
self.p1;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
begin
|
||||
var o := new t2;
|
||||
assert(i = 2);
|
||||
end.
|
||||
|
|
@ -2041,12 +2041,18 @@ namespace PascalABCCompiler.TreeRealization
|
|||
//sil = (base_type as compiled_generic_instance_type_node).original_generic.find_in_type(name, CurrentScope);
|
||||
return sil;
|
||||
}
|
||||
|
||||
|
||||
if (sil == null && base_type is compiled_type_node && string.Compare(name, "create", true) != 0)
|
||||
type_node base_tn = base_type;
|
||||
if (sil == null && string.Compare(name, "create", true) != 0)
|
||||
{
|
||||
sil = (base_type as compiled_type_node).find_in_type(name, CurrentScope);
|
||||
while (sil == null && base_tn != null)
|
||||
{
|
||||
if (base_tn is compiled_type_node)
|
||||
sil = (base_tn as compiled_type_node).find_in_type(name, CurrentScope);
|
||||
base_tn = base_tn.base_type;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.is_generic_parameter && sil != null)
|
||||
{
|
||||
sil = sil?.Select(x => x.copy()).ToList();
|
||||
|
|
|
|||
Loading…
Reference in a new issue