This commit is contained in:
Бондарев Иван 2019-10-04 18:52:48 +02:00
parent 01afc8b35b
commit 9e7af6301e
3 changed files with 24 additions and 1 deletions

View 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.

View file

@ -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;

View file

@ -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));
} }