This commit is contained in:
parent
28a1a03e8d
commit
771ea7b445
|
|
@ -320,11 +320,6 @@ function Cart<T, T1>(Self: sequence of T; b: sequence of T1): sequence of (T, T1
|
|||
function Cart<T, T1, T2>(Self: sequence of T; b: sequence of T1; func: (T,T1)->T2): sequence of T2; extensionmethod
|
||||
:= Self.Cartesian(b,func);
|
||||
|
||||
|
||||
/// Возвращает все сочетания по m элементов
|
||||
function Cmb<T>(Self: array of T; m: integer): sequence of array of T; extensionmethod
|
||||
:= Self.Combinations(m);
|
||||
|
||||
/// Возвращает все сочетания по m элементов
|
||||
function Cmb<T>(Self: sequence of T; m: integer): sequence of array of T; extensionmethod
|
||||
:= Self.Combinations(m);
|
||||
|
|
|
|||
6
TestSuite/errors/err0543.pas
Normal file
6
TestSuite/errors/err0543.pas
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
//!Повторное объявление
|
||||
function Prm<T>(Self: array of T): integer; extensionmethod := 1;
|
||||
function Prm<T>(Self: array of T): integer; extensionmethod := 1;
|
||||
|
||||
begin
|
||||
end.
|
||||
6
TestSuite/errors/err0544.pas
Normal file
6
TestSuite/errors/err0544.pas
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
//!Повторное объявление
|
||||
procedure Prm<T>(Self: array of T); extensionmethod; begin end;
|
||||
procedure Prm<T>(Self: array of T); extensionmethod; begin end;
|
||||
|
||||
begin
|
||||
end.
|
||||
|
|
@ -2,12 +2,12 @@
|
|||
begin
|
||||
System.Array.Reverse(Self);
|
||||
Result := Self;
|
||||
end;}
|
||||
end;
|
||||
|
||||
function BinarySearch<T>(self: array of T; item: T): integer; extensionmethod;
|
||||
begin
|
||||
Result := System.Array.BinarySearch(self,item);
|
||||
end;
|
||||
end;}
|
||||
|
||||
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@ begin
|
|||
self.AddRange(arr);
|
||||
end;
|
||||
|
||||
function BinarySearch<T>(self: array of T; item: T): integer; extensionmethod;
|
||||
{function BinarySearch<T>(self: array of T; item: T): integer; extensionmethod;
|
||||
begin
|
||||
Result := System.Array.BinarySearch(self, item);
|
||||
end;
|
||||
end;}
|
||||
|
||||
procedure Test1<T>(self: array[,] of T); extensionmethod;
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -3229,6 +3229,17 @@ namespace PascalABCCompiler.TreeConverter
|
|||
}
|
||||
}
|
||||
}
|
||||
if (_ctn.type_special_kind == SemanticTree.type_special_kind.array_kind && _ctn.element_type.is_generic_parameter)
|
||||
{
|
||||
var arr_types = type_constructor.instance.get_generic_arrays(_ctn.rank);
|
||||
foreach (var ctn in arr_types)
|
||||
{
|
||||
var addit_si_list = ctn.Scope.FindOnlyInScope(fn.name);
|
||||
if (addit_si_list != null)
|
||||
si_list.AddRange(addit_si_list);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else if (_compiled_tn != null)
|
||||
{
|
||||
|
|
@ -3262,7 +3273,10 @@ namespace PascalABCCompiler.TreeConverter
|
|||
foreach (var tmp_si in si_list)
|
||||
{
|
||||
if (tmp_si.sym_info == fn)
|
||||
{
|
||||
|
||||
continue;
|
||||
}
|
||||
if (tmp_si.sym_info.general_node_type != general_node_type.function_node)
|
||||
{
|
||||
TreeRealization.BasePCUReader.RestoreSymbols(si_list, fn.name);
|
||||
|
|
|
|||
|
|
@ -14155,6 +14155,7 @@ namespace PascalABCCompiler.TreeConverter
|
|||
common_type_node common_converted_type_tmp = context.converted_type;
|
||||
compiled_type_node compiled_converted_type_tmp = context.converted_compiled_type;
|
||||
common_namespace_function_node cnfn2 = context.top_function as common_namespace_function_node;
|
||||
|
||||
if (cnfn2 != null && cnfn2.ConnectedToType != null)
|
||||
{
|
||||
if (cnfn2.ConnectedToType is compiled_type_node)
|
||||
|
|
@ -14346,8 +14347,20 @@ namespace PascalABCCompiler.TreeConverter
|
|||
}
|
||||
}
|
||||
}
|
||||
bool unique = context.close_function_params(body_exists);
|
||||
common_type_node common_converted_type_tmp = context.converted_type;
|
||||
compiled_type_node compiled_converted_type_tmp = context.converted_compiled_type;
|
||||
common_namespace_function_node cnfn2 = context.top_function as common_namespace_function_node;
|
||||
|
||||
if (cnfn2 != null && cnfn2.ConnectedToType != null)
|
||||
{
|
||||
if (cnfn2.ConnectedToType is compiled_type_node)
|
||||
context.converted_compiled_type = cnfn2.ConnectedToType as compiled_type_node;
|
||||
else if (cnfn2.ConnectedToType is common_type_node)
|
||||
context.converted_type = cnfn2.ConnectedToType as common_type_node;
|
||||
}
|
||||
bool unique = context.close_function_params(body_exists);
|
||||
context.converted_compiled_type = compiled_converted_type_tmp;
|
||||
context.converted_type = common_converted_type_tmp;
|
||||
if (context.converted_type != null && context.converted_type.IsInterface)
|
||||
{
|
||||
if (body_exists)
|
||||
|
|
|
|||
|
|
@ -38,6 +38,25 @@ namespace PascalABCCompiler.TreeConverter
|
|||
private System.Collections.Generic.Dictionary<type_node, List<type_node>> types_unsized_arrays =
|
||||
new System.Collections.Generic.Dictionary<type_node, List<type_node>>();
|
||||
|
||||
public List<common_type_node> get_generic_arrays(int rank)
|
||||
{
|
||||
List<common_type_node> lst = new List<common_type_node>();
|
||||
foreach (var key in types_unsized_arrays.Keys)
|
||||
{
|
||||
if (key.is_generic_parameter)
|
||||
{
|
||||
List<type_node> ret = types_unsized_arrays[key];
|
||||
for (int i = 0; i < ret.Count; i++)
|
||||
if (ret[i] is common_type_node ctn)
|
||||
{
|
||||
if (ctn.rank == rank)
|
||||
lst.Add(ctn);
|
||||
}
|
||||
}
|
||||
}
|
||||
return lst;
|
||||
}
|
||||
|
||||
public type_node create_unsized_array(type_node element_type, int rank, location loc)
|
||||
{
|
||||
List<type_node> ret = null;
|
||||
|
|
|
|||
|
|
@ -320,11 +320,6 @@ function Cart<T, T1>(Self: sequence of T; b: sequence of T1): sequence of (T, T1
|
|||
function Cart<T, T1, T2>(Self: sequence of T; b: sequence of T1; func: (T,T1)->T2): sequence of T2; extensionmethod
|
||||
:= Self.Cartesian(b,func);
|
||||
|
||||
|
||||
/// Возвращает все сочетания по m элементов
|
||||
function Cmb<T>(Self: array of T; m: integer): sequence of array of T; extensionmethod
|
||||
:= Self.Combinations(m);
|
||||
|
||||
/// Возвращает все сочетания по m элементов
|
||||
function Cmb<T>(Self: sequence of T; m: integer): sequence of array of T; extensionmethod
|
||||
:= Self.Combinations(m);
|
||||
|
|
|
|||
Loading…
Reference in a new issue