fix #2111
This commit is contained in:
parent
01afc8b35b
commit
9e7af6301e
22
TestSuite/partial_generics1.pas
Normal file
22
TestSuite/partial_generics1.pas
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
type
|
||||||
|
T1<T> = partial class
|
||||||
|
i: integer;
|
||||||
|
procedure Test;
|
||||||
|
begin
|
||||||
|
Inc(i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
T1<T> = partial class
|
||||||
|
procedure Test2;
|
||||||
|
begin
|
||||||
|
Inc(i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
var obj := new T1<integer>;
|
||||||
|
obj.Test;
|
||||||
|
obj.Test2;
|
||||||
|
assert(obj.i = 2);
|
||||||
|
end.
|
||||||
|
|
@ -2550,6 +2550,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
//cnode.ForwardDeclarationOnly = false;
|
//cnode.ForwardDeclarationOnly = false;
|
||||||
return cnode;
|
return cnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cnode != null && is_partial && cnode.IsPartial)
|
if (cnode != null && is_partial && cnode.IsPartial)
|
||||||
{
|
{
|
||||||
return cnode;
|
return cnode;
|
||||||
|
|
|
||||||
|
|
@ -11697,7 +11697,7 @@ namespace PascalABCCompiler.TreeConverter
|
||||||
{
|
{
|
||||||
List<SymbolInfo> sil = context.find_only_in_namespace(_type_declaration.type_name.name + compiler_string_consts.generic_params_infix +
|
List<SymbolInfo> sil = context.find_only_in_namespace(_type_declaration.type_name.name + compiler_string_consts.generic_params_infix +
|
||||||
cl_def.template_args.idents.Count.ToString());
|
cl_def.template_args.idents.Count.ToString());
|
||||||
if (!(sil != null && sil.FirstOrDefault().sym_info is common_type_node && context.types_predefined.IndexOf(sil.FirstOrDefault().sym_info as common_type_node) != -1))
|
if (!(sil != null && sil.FirstOrDefault().sym_info is common_type_node && ((sil.FirstOrDefault().sym_info as common_type_node).IsPartial || context.types_predefined.IndexOf(sil.FirstOrDefault().sym_info as common_type_node) != -1)))
|
||||||
{
|
{
|
||||||
context.check_name_free(_type_declaration.type_name.name, get_location(_type_declaration.type_name));
|
context.check_name_free(_type_declaration.type_name.name, get_location(_type_declaration.type_name));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue