fix #2350
This commit is contained in:
parent
48222f9576
commit
513f7857a5
|
|
@ -15,7 +15,7 @@ internal static class RevisionClass
|
|||
public const string Major = "3";
|
||||
public const string Minor = "7";
|
||||
public const string Build = "1";
|
||||
public const string Revision = "2747";
|
||||
public const string Revision = "2750";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%MINOR%=7
|
||||
%REVISION%=2747
|
||||
%COREVERSION%=1
|
||||
%REVISION%=2750
|
||||
%MINOR%=7
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
3.7.1.2747
|
||||
3.7.1.2750
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.7.1.2747'
|
||||
!define VERSION '3.7.1.2750'
|
||||
|
|
|
|||
7
TestSuite/BigIntSeqSumProduct.pas
Normal file
7
TestSuite/BigIntSeqSumProduct.pas
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
begin
|
||||
var a := Arr(1bi,2bi,4bi);
|
||||
Assert(a.Sum = 7bi);
|
||||
Assert(a.Product = 8bi);
|
||||
var lst := new List<integer>();
|
||||
lst.Sum;
|
||||
end.
|
||||
|
|
@ -2142,6 +2142,10 @@ function NextPermutation(a: array of integer): boolean;
|
|||
function Range(a, b: integer): sequence of integer;
|
||||
/// Возвращает последовательность целых от a до b с шагом step
|
||||
function Range(a, b, step: integer): sequence of integer;
|
||||
/// Возвращает последовательность длинных целых от a до b
|
||||
function Range(a, b: BigInteger): sequence of BigInteger;
|
||||
/// Возвращает последовательность длинных целых от a до b с шагом step
|
||||
function Range(a, b, step: BigInteger): sequence of BigInteger;
|
||||
/// Возвращает последовательность символов от c1 до c2
|
||||
function Range(c1, c2: char): sequence of char;
|
||||
/// Возвращает последовательность символов от c1 до c2 с шагом step
|
||||
|
|
@ -4557,7 +4561,7 @@ begin
|
|||
else Result := System.Linq.Enumerable.Range(a, b - a + 1);
|
||||
end;
|
||||
|
||||
function Range(a, b: real; n: integer): sequence of real;
|
||||
function PartitionPoints(a, b: real; n: integer): sequence of real;
|
||||
begin
|
||||
if n = 0 then
|
||||
raise new System.ArgumentException('Range: n=0');
|
||||
|
|
@ -4582,11 +4586,26 @@ begin
|
|||
Result := Range(integer(c1), integer(c2), step).Select(x -> Chr(x));
|
||||
end;
|
||||
|
||||
function PartitionPoints(a, b: real; n: integer): sequence of real;
|
||||
function Range(a, b, step: BigInteger): sequence of BigInteger;
|
||||
begin
|
||||
Result := Range(a, b, n)
|
||||
if step = 0 then
|
||||
raise new System.ArgumentException('step=0');
|
||||
if step > 0 then
|
||||
while a<=b do
|
||||
begin
|
||||
yield a;
|
||||
a += step;
|
||||
end
|
||||
else
|
||||
while a>=b do
|
||||
begin
|
||||
yield a;
|
||||
a += step;
|
||||
end
|
||||
end;
|
||||
|
||||
function Range(a, b: BigInteger): sequence of BigInteger := Range(a,b,1);
|
||||
|
||||
type
|
||||
ArithmSeq = auto class
|
||||
a, step: integer;
|
||||
|
|
@ -9745,6 +9764,40 @@ begin
|
|||
Result += f(x);
|
||||
end;}
|
||||
|
||||
// SSM 23/11/2020 - Sum Average Product for sequence of BigInteger
|
||||
|
||||
/// Возвращает сумму элементов последовательности
|
||||
function Sum(Self: sequence of BigInteger): BigInteger; extensionmethod;
|
||||
begin
|
||||
Result := 0bi;
|
||||
foreach var a in Self do
|
||||
Result += a
|
||||
end;
|
||||
|
||||
/// Возвращает среднее элементов последовательности
|
||||
function Average(Self: sequence of BigInteger): real; extensionmethod;
|
||||
begin
|
||||
var cnt := 0;
|
||||
var sum := 0bi;
|
||||
foreach var a in Self do
|
||||
begin
|
||||
sum += a;
|
||||
cnt += 1;
|
||||
end;
|
||||
if cnt <> 0 then
|
||||
Result := sum/cnt
|
||||
else Result := 0
|
||||
end;
|
||||
|
||||
/// Возвращает произведение элементов последовательности
|
||||
function Product(Self: sequence of BigInteger): BigInteger; extensionmethod;
|
||||
begin
|
||||
Result := 1bi;
|
||||
foreach var a in Self do
|
||||
Result *= a
|
||||
end;
|
||||
|
||||
|
||||
|
||||
/// Возвращает отсортированную по возрастанию последовательность
|
||||
function Sorted<T>(Self: sequence of T): sequence of T; extensionmethod;
|
||||
|
|
|
|||
|
|
@ -3582,7 +3582,7 @@ namespace PascalABCCompiler.TreeRealization
|
|||
start = ext.GetRange(cur_index, ext.Count() - cur_index);
|
||||
if (result != null)
|
||||
{
|
||||
result.RemoveRange(1, result.Count() - 1);
|
||||
//result.RemoveRange(1, result.Count() - 1);
|
||||
result.AddRange(start);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -628,7 +628,7 @@ type
|
|||
Result := (l = r2.l) and (h = r2.h);
|
||||
end;
|
||||
function GetHashCode: integer; override := l.GetHashCode xor h.GetHashCode;
|
||||
function ToArray: array of integer;
|
||||
{function ToArray: array of integer;
|
||||
begin
|
||||
Result := new integer[Count];
|
||||
var x := l;
|
||||
|
|
@ -640,14 +640,14 @@ type
|
|||
end;
|
||||
function ToList: List<integer>;
|
||||
begin
|
||||
Result := new List<integer>;
|
||||
Result := new List<integer>(Count);
|
||||
var x := l;
|
||||
loop Count do
|
||||
begin
|
||||
Result.Add(x);
|
||||
x += 1;
|
||||
end;
|
||||
end;
|
||||
end;}
|
||||
function ToLinkedList: LinkedList<integer>;
|
||||
begin
|
||||
Result := new LinkedList<integer>(System.Linq.Enumerable.Range(l,Count));
|
||||
|
|
@ -701,7 +701,7 @@ type
|
|||
end;
|
||||
function GetHashCode: integer; override := l.GetHashCode xor h.GetHashCode;
|
||||
|
||||
function ToArray: array of char;
|
||||
{function ToArray: array of char;
|
||||
begin
|
||||
Result := new char[Count];
|
||||
var x := l;
|
||||
|
|
@ -720,7 +720,7 @@ type
|
|||
Result.Add(x);
|
||||
x := char(integer(x) + 1);
|
||||
end;
|
||||
end;
|
||||
end;}
|
||||
function ToLinkedList: LinkedList<char>;
|
||||
begin
|
||||
Result := new LinkedList<char>(System.Linq.Enumerable.Range(integer(l),Count).Select(i -> char(i)));
|
||||
|
|
@ -2142,6 +2142,10 @@ function NextPermutation(a: array of integer): boolean;
|
|||
function Range(a, b: integer): sequence of integer;
|
||||
/// Возвращает последовательность целых от a до b с шагом step
|
||||
function Range(a, b, step: integer): sequence of integer;
|
||||
/// Возвращает последовательность длинных целых от a до b
|
||||
function Range(a, b: BigInteger): sequence of BigInteger;
|
||||
/// Возвращает последовательность длинных целых от a до b с шагом step
|
||||
function Range(a, b, step: BigInteger): sequence of BigInteger;
|
||||
/// Возвращает последовательность символов от c1 до c2
|
||||
function Range(c1, c2: char): sequence of char;
|
||||
/// Возвращает последовательность символов от c1 до c2 с шагом step
|
||||
|
|
@ -4557,7 +4561,7 @@ begin
|
|||
else Result := System.Linq.Enumerable.Range(a, b - a + 1);
|
||||
end;
|
||||
|
||||
function Range(a, b: real; n: integer): sequence of real;
|
||||
function PartitionPoints(a, b: real; n: integer): sequence of real;
|
||||
begin
|
||||
if n = 0 then
|
||||
raise new System.ArgumentException('Range: n=0');
|
||||
|
|
@ -4582,11 +4586,26 @@ begin
|
|||
Result := Range(integer(c1), integer(c2), step).Select(x -> Chr(x));
|
||||
end;
|
||||
|
||||
function PartitionPoints(a, b: real; n: integer): sequence of real;
|
||||
function Range(a, b, step: BigInteger): sequence of BigInteger;
|
||||
begin
|
||||
Result := Range(a, b, n)
|
||||
if step = 0 then
|
||||
raise new System.ArgumentException('step=0');
|
||||
if step > 0 then
|
||||
while a<=b do
|
||||
begin
|
||||
yield a;
|
||||
a += step;
|
||||
end
|
||||
else
|
||||
while a>=b do
|
||||
begin
|
||||
yield a;
|
||||
a += step;
|
||||
end
|
||||
end;
|
||||
|
||||
function Range(a, b: BigInteger): sequence of BigInteger := Range(a,b,1);
|
||||
|
||||
type
|
||||
ArithmSeq = auto class
|
||||
a, step: integer;
|
||||
|
|
@ -9745,6 +9764,40 @@ begin
|
|||
Result += f(x);
|
||||
end;}
|
||||
|
||||
// SSM 23/11/2020 - Sum Average Product for sequence of BigInteger
|
||||
|
||||
/// Возвращает сумму элементов последовательности
|
||||
function Sum(Self: sequence of BigInteger): BigInteger; extensionmethod;
|
||||
begin
|
||||
Result := 0bi;
|
||||
foreach var a in Self do
|
||||
Result += a
|
||||
end;
|
||||
|
||||
/// Возвращает среднее элементов последовательности
|
||||
function Average(Self: sequence of BigInteger): real; extensionmethod;
|
||||
begin
|
||||
var cnt := 0;
|
||||
var sum := 0bi;
|
||||
foreach var a in Self do
|
||||
begin
|
||||
sum += a;
|
||||
cnt += 1;
|
||||
end;
|
||||
if cnt <> 0 then
|
||||
Result := sum/cnt
|
||||
else Result := 0
|
||||
end;
|
||||
|
||||
/// Возвращает произведение элементов последовательности
|
||||
function Product(Self: sequence of BigInteger): BigInteger; extensionmethod;
|
||||
begin
|
||||
Result := 1bi;
|
||||
foreach var a in Self do
|
||||
Result *= a
|
||||
end;
|
||||
|
||||
|
||||
|
||||
/// Возвращает отсортированную по возрастанию последовательность
|
||||
function Sorted<T>(Self: sequence of T): sequence of T; extensionmethod;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ INTEGER_OR_CHAR_VALUE_EXPECTED=Ожидалось значение целого
|
|||
INCOMPATIBLE_DIAPASON_BOUNDS_TYPES=Несовместимые типы границ диапазона
|
||||
INCOMPATIBLE_TYPES_OF_ELEMENT_AND_DIAPASON=Тип элемента несовместим с типом диапазона
|
||||
BAD_SLICE_OBJECT=Срезы допустимы только для строк, динамических массивов и списков
|
||||
ONLY_IN_SHORT_FUNC_DEFS_RETURN_TYPE_CANBE_OMITTED=Только в коротких определениях функций можно не указывать тип возвращаемого значения
|
||||
ONLY_IN_SHORT_FUNC_DEFS_RETURN_TYPE_CANBE_OMITTED=Тип возвращаемого значения следует указать явно
|
||||
ONE_TKIDENTIFIER=В качестве типа ожидался идентификатор
|
||||
SUGARED_NODE_{0}_IN_SYNTAX_TREE_VISITOR=Сахарный узел {0} не должен обходиться в syntax_tree_visitor. Обратитесь к разработчикам PascalABC.NET
|
||||
MISSED_SEMANTIC_CHECK_FOR_SUGARED_NODE_{0}=Отсутствует семантическая проверка для сахарного узла {0}
|
||||
|
|
|
|||
Loading…
Reference in a new issue