fix #2363.pas
School function MinMax(s: sequence of BigInteger): (BigInteger, BigInteger);
This commit is contained in:
parent
d85b2fa63f
commit
61d7177d05
|
|
@ -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 = "2767";
|
||||
public const string Revision = "2768";
|
||||
|
||||
public const string MainVersion = Major + "." + Minor;
|
||||
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%MINOR%=7
|
||||
%REVISION%=2767
|
||||
%COREVERSION%=1
|
||||
%REVISION%=2768
|
||||
%MINOR%=7
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
3.7.1.2767
|
||||
3.7.1.2768
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.7.1.2767'
|
||||
!define VERSION '3.7.1.2768'
|
||||
|
|
|
|||
14
TestSuite/2363.pas
Normal file
14
TestSuite/2363.pas
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
procedure p0<T>(o: T);
|
||||
begin
|
||||
//Print(1);
|
||||
end;
|
||||
|
||||
procedure p1<T>; where T: record;
|
||||
begin
|
||||
//Ошибка: Возможны два преобразования типов
|
||||
p0&<T?>(nil);
|
||||
end;
|
||||
|
||||
begin
|
||||
Assert(1=1)
|
||||
end.
|
||||
|
|
@ -41,6 +41,9 @@ function MinMax(s: sequence of integer): (integer, integer);
|
|||
/// Возвращает кортеж из минимума и максимума последовательности s
|
||||
function MinMax(s: sequence of real): (real, real);
|
||||
|
||||
/// Возвращает кортеж из минимума и максимума последовательности s
|
||||
function MinMax(s: sequence of BigInteger): (BigInteger, BigInteger);
|
||||
|
||||
/// Возвращает НОД
|
||||
function НОД(a, b: int64): int64;
|
||||
|
||||
|
|
@ -316,6 +319,24 @@ begin
|
|||
Result := (min, max)
|
||||
end;
|
||||
|
||||
/// Возвращает кортеж из минимума и максимума последовательности s
|
||||
function MinMax(s: sequence of BigInteger): (BigInteger, BigInteger);
|
||||
begin
|
||||
var min, max: BigInteger;
|
||||
var FirstValue := True;
|
||||
foreach var m in s do
|
||||
if FirstValue then
|
||||
(min, max, FirstValue) := (m, m, False)
|
||||
else
|
||||
begin
|
||||
if m < min then
|
||||
min := m;
|
||||
if m > max then
|
||||
max := m
|
||||
end;
|
||||
Result := (min, max)
|
||||
end;
|
||||
|
||||
/// Возвращает кортеж из минимума и максимума последовательности
|
||||
function MinMax(Self: sequence of int64): (int64, int64); extensionmethod :=
|
||||
MinMax(Self);
|
||||
|
|
@ -329,6 +350,10 @@ MinMax(Self);
|
|||
function MinMax(Self: sequence of real): (real, real); extensionmethod :=
|
||||
MinMax(Self);
|
||||
|
||||
/// Возвращает кортеж из минимума и максимума последовательности
|
||||
function MinMax(Self: sequence of BigInteger): (BigInteger, BigInteger);
|
||||
extensionmethod := MinMax(Self);
|
||||
|
||||
{$endregion}
|
||||
|
||||
{$region GCDLCM}
|
||||
|
|
|
|||
|
|
@ -1667,6 +1667,8 @@ namespace PascalABCCompiler.TreeConverter
|
|||
{
|
||||
if (ptc.second!=null)
|
||||
{
|
||||
if (ptc.first.from is null_type_node || ptc.second.from is null_type_node)
|
||||
continue; // SSM 9/12/20 fix 2363
|
||||
AddError(new PossibleTwoTypeConversionsInFunctionCall(loc,ptc.first,ptc.second));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ function MinMax(s: sequence of integer): (integer, integer);
|
|||
/// Возвращает кортеж из минимума и максимума последовательности s
|
||||
function MinMax(s: sequence of real): (real, real);
|
||||
|
||||
/// Возвращает кортеж из минимума и максимума последовательности s
|
||||
function MinMax(s: sequence of BigInteger): (BigInteger, BigInteger);
|
||||
|
||||
/// Возвращает НОД
|
||||
function НОД(a, b: int64): int64;
|
||||
|
||||
|
|
@ -316,6 +319,24 @@ begin
|
|||
Result := (min, max)
|
||||
end;
|
||||
|
||||
/// Возвращает кортеж из минимума и максимума последовательности s
|
||||
function MinMax(s: sequence of BigInteger): (BigInteger, BigInteger);
|
||||
begin
|
||||
var min, max: BigInteger;
|
||||
var FirstValue := True;
|
||||
foreach var m in s do
|
||||
if FirstValue then
|
||||
(min, max, FirstValue) := (m, m, False)
|
||||
else
|
||||
begin
|
||||
if m < min then
|
||||
min := m;
|
||||
if m > max then
|
||||
max := m
|
||||
end;
|
||||
Result := (min, max)
|
||||
end;
|
||||
|
||||
/// Возвращает кортеж из минимума и максимума последовательности
|
||||
function MinMax(Self: sequence of int64): (int64, int64); extensionmethod :=
|
||||
MinMax(Self);
|
||||
|
|
@ -329,6 +350,10 @@ MinMax(Self);
|
|||
function MinMax(Self: sequence of real): (real, real); extensionmethod :=
|
||||
MinMax(Self);
|
||||
|
||||
/// Возвращает кортеж из минимума и максимума последовательности
|
||||
function MinMax(Self: sequence of BigInteger): (BigInteger, BigInteger);
|
||||
extensionmethod := MinMax(Self);
|
||||
|
||||
{$endregion}
|
||||
|
||||
{$region GCDLCM}
|
||||
|
|
|
|||
Loading…
Reference in a new issue