diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index db8a6b68d..f27ac01a1 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "4"; public const string Build = "0"; - public const string Revision = "1678"; + public const string Revision = "1682"; public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; diff --git a/Configuration/Version.defs b/Configuration/Version.defs index df7d9118e..4e22e0aef 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %MINOR%=4 -%REVISION%=1678 +%REVISION%=1682 %COREVERSION%=0 %MAJOR%=3 diff --git a/Localization/DefaultLang.resources b/Localization/DefaultLang.resources index a7959d5d9..581640f5d 100644 Binary files a/Localization/DefaultLang.resources and b/Localization/DefaultLang.resources differ diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs index ef301bb58..7f03a5195 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.cs @@ -2,7 +2,7 @@ // This CSharp output file generated by Gardens Point LEX // Version: 1.1.3.301 // Machine: DESKTOP-A6LT9RI -// DateTime: 12.06.2018 22:19:29 +// DateTime: 28.06.2018 21:28:15 // UserName: ????????? // GPLEX input file // GPLEX frame file diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y index 4532a00fa..3306b46e7 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascal.y +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascal.y @@ -836,6 +836,28 @@ const_factor } | sign const_factor { + // ðó÷íàß êîððåêöèß öåëûõ êîíñòàíò + if ($1.type == Operators.Minus) + { + var i64 = $2 as int64_const; + if (i64 != null && i64.val == (Int64)Int32.MaxValue + 1) + { + $$ = new int32_const(Int32.MinValue); + break; + } + var ui64 = $2 as uint64_const; + if (ui64 != null && ui64.val == (UInt64)Int64.MaxValue + 1) + { + $$ = new int64_const(Int64.MinValue); + break; + } + if (ui64 != null && ui64.val > (UInt64)Int64.MaxValue + 1) + { + parsertools.AddErrorFromResource("BAD_INT2",@$); + break; + } + // ìîæíî ñäåëàòü âû÷èñëåíèå êîíñòàíòû ñ âìîíòèðîâàííûì ìèíóñîì + } $$ = new un_expr($2, $1.type, @$); } | new_expr @@ -3364,7 +3386,29 @@ factor $$ = new un_expr($2, $1.type, @$); } | sign factor - { + { + if ($1.type == Operators.Minus) + { + var i64 = $2 as int64_const; + if (i64 != null && i64.val == (Int64)Int32.MaxValue + 1) + { + $$ = new int32_const(Int32.MinValue); + break; + } + var ui64 = $2 as uint64_const; + if (ui64 != null && ui64.val == (UInt64)Int64.MaxValue + 1) + { + $$ = new int64_const(Int64.MinValue); + break; + } + if (ui64 != null && ui64.val > (UInt64)Int64.MaxValue + 1) + { + parsertools.AddErrorFromResource("BAD_INT2",@$); + break; + } + // ìîæíî ñäåëàòü âû÷èñëåíèå êîíñòàíòû ñ âìîíòèðîâàííûì ìèíóñîì + } + $$ = new un_expr($2, $1.type, @$); } | tkDeref factor diff --git a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs index c36b7e7ad..81f88b16d 100644 --- a/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs +++ b/Parsers/PascalABCParserNewSaushkin/ABCPascalYacc.cs @@ -2,7 +2,7 @@ // GPPG version 1.3.6 // Machine: DESKTOP-A6LT9RI -// DateTime: 12.06.2018 22:19:30 +// DateTime: 28.06.2018 21:28:15 // UserName: ????????? // Input file @@ -3163,6 +3163,28 @@ public partial class GPPGParser: ShiftReduceParser sign, const_factor { + // ������ ��������� ����� �������� + if (ValueStack[ValueStack.Depth-2].op.type == Operators.Minus) + { + var i64 = ValueStack[ValueStack.Depth-1].ex as int64_const; + if (i64 != null && i64.val == (Int64)Int32.MaxValue + 1) + { + CurrentSemanticValue.ex = new int32_const(Int32.MinValue); + break; + } + var ui64 = ValueStack[ValueStack.Depth-1].ex as uint64_const; + if (ui64 != null && ui64.val == (UInt64)Int64.MaxValue + 1) + { + CurrentSemanticValue.ex = new int64_const(Int64.MinValue); + break; + } + if (ui64 != null && ui64.val > (UInt64)Int64.MaxValue + 1) + { + parsertools.AddErrorFromResource("BAD_INT2",CurrentLocationSpan); + break; + } + // ����� ������� ���������� ��������� � �������������� ������� + } CurrentSemanticValue.ex = new un_expr(ValueStack[ValueStack.Depth-1].ex, ValueStack[ValueStack.Depth-2].op.type, CurrentLocationSpan); } break; @@ -5569,7 +5591,29 @@ public partial class GPPGParser: ShiftReduceParser sign, factor -{ +{ + if (ValueStack[ValueStack.Depth-2].op.type == Operators.Minus) + { + var i64 = ValueStack[ValueStack.Depth-1].ex as int64_const; + if (i64 != null && i64.val == (Int64)Int32.MaxValue + 1) + { + CurrentSemanticValue.ex = new int32_const(Int32.MinValue); + break; + } + var ui64 = ValueStack[ValueStack.Depth-1].ex as uint64_const; + if (ui64 != null && ui64.val == (UInt64)Int64.MaxValue + 1) + { + CurrentSemanticValue.ex = new int64_const(Int64.MinValue); + break; + } + if (ui64 != null && ui64.val > (UInt64)Int64.MaxValue + 1) + { + parsertools.AddErrorFromResource("BAD_INT2",CurrentLocationSpan); + break; + } + // ����� ������� ���������� ��������� � �������������� ������� + } + CurrentSemanticValue.ex = new un_expr(ValueStack[ValueStack.Depth-1].ex, ValueStack[ValueStack.Depth-2].op.type, CurrentLocationSpan); } break; diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index a73166aeb..cd5513b4c 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.4.0.1678' +!define VERSION '3.4.0.1682' diff --git a/SyntaxTreeConverters/StandardSyntaxConverter.cs b/SyntaxTreeConverters/StandardSyntaxConverter.cs index f6f541f5c..a13edb3e7 100644 --- a/SyntaxTreeConverters/StandardSyntaxConverter.cs +++ b/SyntaxTreeConverters/StandardSyntaxConverter.cs @@ -22,7 +22,7 @@ namespace PascalABCCompiler.SyntaxTreeConverters // Выносим выражения с лямбдами из заголовка foreach StandOutExprWithLambdaInForeachSequenceVisitor.New.ProcessNode(root); - //--- Обработка синтаксически сахарных узлов + // type classes { var typeclasses = SyntaxVisitors.TypeclassVisitors.FindTypeclassesVisitor.New; @@ -32,7 +32,9 @@ namespace PascalABCCompiler.SyntaxTreeConverters SyntaxVisitors.TypeclassVisitors.ReplaceTypeclassVisitor.New(instancesAndRestrictedFunctions).ProcessNode(root); } root.FillParentsInAllChilds(); +#if DEBUG //new SimplePrettyPrinterVisitor("E:/projs/out.txt").ProcessNode(root); +#endif // loop LoopDesugarVisitor.New.ProcessNode(root); diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index dd8bcfb9a..215c7a2a7 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -7455,17 +7455,12 @@ end; function Pos(subs, s: string; from: integer): integer; begin - if (subs = nil) or (subs.Length = 0) then + if (subs = nil) or (subs.Length = 0) or (from > s.Length) then Result := 0 else Result := s.IndexOf(subs, from - 1, System.StringComparison.Ordinal) + 1; end; -function PosEx(subs, s: string; from: integer): integer; -begin - if (subs = nil) or (subs.Length = 0) then - Result := 0 - else Result := s.IndexOf(subs, from - 1, System.StringComparison.Ordinal) + 1; -end; +function PosEx(subs, s: string; from: integer) := Pos(subs,s,from); function LastPos(subs, s: string): integer; begin @@ -7476,20 +7471,19 @@ end; function LastPos(subs, s: string; from: integer): integer; begin - if (subs = nil) or (subs.Length = 0) then + if (subs = nil) or (subs.Length = 0) or (from > s.Length) then Result := 0 else Result := s.LastIndexOf(subs, from - 1, System.StringComparison.Ordinal) + 1; end; -function Pos(c: char; s: string; from: integer): integer; +{function Pos(c: char; s: string; from: integer): integer; begin + if from > s.Length then + Result := 0; Result := s.IndexOf(c, from - 1, System.StringComparison.Ordinal) + 1; end; -function PosEx(c: char; s: string; from: integer): integer; -begin - Result := s.IndexOf(c, from - 1, System.StringComparison.Ordinal) + 1; -end; +function PosEx(c: char; s: string; from: integer) := Pos(c,s,from); function LastPos(c: char; s: string): integer; begin @@ -7498,8 +7492,10 @@ end; function LastPos(c: char; s: string; from: integer): integer; begin + if from > s.Length then + Result := 0; Result := s.LastIndexOf(c, from - 1, System.StringComparison.Ordinal) + 1; -end; +end;} function Length(s: string): integer; begin @@ -7530,7 +7526,7 @@ begin s := s.Substring(0, n) else if s.Length < n then if n <= sz then - s += new string(' ', n - s.Length ) + s += new string(' ', n - s.Length) else s += new String(' ', sz - s.Length) end; @@ -7543,12 +7539,6 @@ begin if index > s.Length + 1 then index := s.Length + 1; s := s.Insert(index - 1, source); - { try - s := s.Insert(index - 1, source); - except - on e: System.Exception do - s := s.Insert(s.Length, source); - end;} end; procedure InsertInShortString(source: string; var s: string; index, n: integer); @@ -7589,14 +7579,6 @@ begin if index + count - 1 > s.Length then count := s.Length - index + 1; Result := s.SubString(index - 1, count); - { try - if index - 1 >= s.Length then - Result := '' - else Result := s.SubString(index - 1, count); - except - on e: System.Exception do - Result := s.Substring(index - 1, s.Length - index + 1); - end;} end; function Concat(s1, s2: string): string; diff --git a/TestSuite/MinInt32Const.pas b/TestSuite/MinInt32Const.pas new file mode 100644 index 000000000..571be7829 --- /dev/null +++ b/TestSuite/MinInt32Const.pas @@ -0,0 +1,4 @@ +begin + var i: integer := -2147483648; + Assert(i.GetType = typeof(integer)); +end. \ No newline at end of file diff --git a/TestSuite/formatter_tests/input/PABCSystem.pas b/TestSuite/formatter_tests/input/PABCSystem.pas index 6206c1069..215c7a2a7 100644 --- a/TestSuite/formatter_tests/input/PABCSystem.pas +++ b/TestSuite/formatter_tests/input/PABCSystem.pas @@ -1220,6 +1220,8 @@ function Power(x: BigInteger; y: integer): BigInteger; /// Возвращает x, округленное до ближайшего целого. Если вещественное находится посередине между двумя целыми, ///то округление осуществляется к ближайшему четному (банковское округление): Round(2.5)=2, Round(3.5)=4 function Round(x: real): integer; +/// Возвращает x, округленное до ближайшего вещественного с digits знаками после десятичной точки +function Round(x: real; digits: integer): real; /// Возвращает x, округленное до ближайшего длинного целого function RoundBigInteger(x: real): BigInteger; /// Возвращает целую часть вещественного числа x @@ -2073,6 +2075,49 @@ type end; end; + +type + ///-- + __TypeclassRestrictedFunctionAttribute = class(Attribute) + public + constructor; + begin + end; + end; + + + ///-- + __TypeclassGenericParameterAttribute = class(Attribute) + public + constructor(instanceName: string); + begin + end; + end; + + ///-- + __TypeclassAttribute = class(Attribute) + public + constructor(typeclassName: string); + begin + end; + end; + + ///-- + __TypeclassMemberAttribute = class(Attribute) + public + constructor; + begin + end; + end; + + ///-- + __TypeclassInstanceAttribute = class(Attribute) + public + constructor(instanceName: string); + begin + end; + end; + // ----------------------------------------------------- // Internal procedures for PABCRTL.dll // ----------------------------------------------------- @@ -3494,7 +3539,7 @@ begin Result := Self; end; -function operator=(x,y: HashSet): boolean; extensionmethod; +function InternalEqual(x,y: HashSet): boolean; begin var xn := Object.ReferenceEquals(x,nil); var yn := Object.ReferenceEquals(y,nil); @@ -3505,7 +3550,9 @@ begin else Result := x.SetEquals(y); end; -function operator<>(x,y: HashSet); extensionmethod := not (x=y); +function operator=(x,y: HashSet): boolean; extensionmethod := InternalEqual(x,y); + +function operator<>(x,y: HashSet); extensionmethod := not InternalEqual(x,y); function operator-(x, y: HashSet): HashSet; extensionmethod; begin @@ -3579,7 +3626,7 @@ begin Result := Self; end; -function operator=(x,y: SortedSet): boolean; extensionmethod; +function InternalEqual(x,y: SortedSet): boolean; begin var xn := Object.ReferenceEquals(x,nil); var yn := Object.ReferenceEquals(y,nil); @@ -3590,7 +3637,9 @@ begin else Result := x.SetEquals(y); end; -function operator<>(x, y: SortedSet); extensionmethod := not x.SetEquals(y); +function operator=(x,y: SortedSet): boolean; extensionmethod := InternalEqual(x,y); + +function operator<>(x, y: SortedSet); extensionmethod := not InternalEqual(x,y); function operator-(x, y: SortedSet): SortedSet; extensionmethod; begin @@ -4238,6 +4287,7 @@ begin end; end; +///-- procedure Deconstruct(self: T; var res: T); extensionmethod; begin res := self; @@ -6594,14 +6644,14 @@ begin else if not cond then begin var err := 'Сбой подтверждения: ' + message + Environment.NewLine + 'Файл ' + sourceFile + ', строка ' + line.ToString(); - writeln(err); + Writeln(err); System.Threading.Thread.Sleep(500); raise new Exception(); end; end else //System.Diagnostics.Debug.Assert(cond, message); - System.Diagnostics.Contracts.Contract.Assert(cond,'Файл '+sourceFile+', строка '+line.ToString()) + System.Diagnostics.Contracts.Contract.Assert(cond,'Файл '+sourceFile+', строка '+line.ToString() + ': ' + message) end; function DiskFree(diskname: string): int64; @@ -6963,6 +7013,8 @@ function Power(x: BigInteger; y: integer) := BigInteger.Pow(x, y); function Round(x: real) := Convert.ToInt32(Math.Round(x)); +function Round(x: real; digits: integer) := Math.Round(x,digits); + function RoundBigInteger(x: real) := BigInteger.Create(Math.Round(x)); function Trunc(x: real) := Convert.ToInt32(Math.Truncate(x)); @@ -7403,17 +7455,12 @@ end; function Pos(subs, s: string; from: integer): integer; begin - if (subs = nil) or (subs.Length = 0) then + if (subs = nil) or (subs.Length = 0) or (from > s.Length) then Result := 0 else Result := s.IndexOf(subs, from - 1, System.StringComparison.Ordinal) + 1; end; -function PosEx(subs, s: string; from: integer): integer; -begin - if (subs = nil) or (subs.Length = 0) then - Result := 0 - else Result := s.IndexOf(subs, from - 1, System.StringComparison.Ordinal) + 1; -end; +function PosEx(subs, s: string; from: integer) := Pos(subs,s,from); function LastPos(subs, s: string): integer; begin @@ -7424,20 +7471,19 @@ end; function LastPos(subs, s: string; from: integer): integer; begin - if (subs = nil) or (subs.Length = 0) then + if (subs = nil) or (subs.Length = 0) or (from > s.Length) then Result := 0 else Result := s.LastIndexOf(subs, from - 1, System.StringComparison.Ordinal) + 1; end; -function Pos(c: char; s: string; from: integer): integer; +{function Pos(c: char; s: string; from: integer): integer; begin + if from > s.Length then + Result := 0; Result := s.IndexOf(c, from - 1, System.StringComparison.Ordinal) + 1; end; -function PosEx(c: char; s: string; from: integer): integer; -begin - Result := s.IndexOf(c, from - 1, System.StringComparison.Ordinal) + 1; -end; +function PosEx(c: char; s: string; from: integer) := Pos(c,s,from); function LastPos(c: char; s: string): integer; begin @@ -7446,8 +7492,10 @@ end; function LastPos(c: char; s: string; from: integer): integer; begin + if from > s.Length then + Result := 0; Result := s.LastIndexOf(c, from - 1, System.StringComparison.Ordinal) + 1; -end; +end;} function Length(s: string): integer; begin @@ -7478,7 +7526,7 @@ begin s := s.Substring(0, n) else if s.Length < n then if n <= sz then - s += new string(' ', n - s.Length ) + s += new string(' ', n - s.Length) else s += new String(' ', sz - s.Length) end; @@ -7491,12 +7539,6 @@ begin if index > s.Length + 1 then index := s.Length + 1; s := s.Insert(index - 1, source); - { try - s := s.Insert(index - 1, source); - except - on e: System.Exception do - s := s.Insert(s.Length, source); - end;} end; procedure InsertInShortString(source: string; var s: string; index, n: integer); @@ -7537,14 +7579,6 @@ begin if index + count - 1 > s.Length then count := s.Length - index + 1; Result := s.SubString(index - 1, count); - { try - if index - 1 >= s.Length then - Result := '' - else Result := s.SubString(index - 1, count); - except - on e: System.Exception do - Result := s.Substring(index - 1, s.Length - index + 1); - end;} end; function Concat(s1, s2: string): string; @@ -9952,6 +9986,12 @@ begin Result := Round(Self); end; +/// Возвращает x, округленное до ближайшего вещественного с digits знаками после десятичной точки +function Round(Self: real; digits: integer): real; extensionmethod; +begin + Result := Round(Self,digits); +end; + /// Возвращает число, округленное до ближайшего длинного целого function RoundBigInteger(Self: real): BigInteger; extensionmethod; begin @@ -10358,9 +10398,21 @@ begin end; ///-- -function operator= (Self: (T1,T2); v: (T1,T2)); extensionmethod := Object.ReferenceEquals(Self,nil) ? Object.ReferenceEquals(v,nil): Self.Equals(v); +function InternalEqual (x: (T1,T2); y: (T1,T2)): boolean; +begin + var xn := Object.ReferenceEquals(x,nil); + var yn := Object.ReferenceEquals(y,nil); + if xn then + Result := yn + else if yn then + Result := xn + else Result := x.Equals(y); +end; + ///-- -function operator<> (Self: (T1,T2); v: (T1,T2)); extensionmethod := not (Self = v); +function operator= (x: (T1,T2); y: (T1,T2)): boolean; extensionmethod := InternalEqual(x,y); +///-- +function operator<> (x: (T1,T2); y: (T1,T2)): boolean; extensionmethod := not InternalEqual(x,y); ///-- function CompareToTup2(v1: (T1, T2); v2: (T1, T2)) := (v1 as System.IComparable).CompareTo(v2); ///-- @@ -10373,9 +10425,20 @@ function operator>(Self: (T1, T2); v: (T1, T2)); extensionmethod := Comp function operator>=(Self: (T1, T2); v: (T1, T2)); extensionmethod := CompareToTup2(Self, v) >= 0; ///-- -function operator= (Self: (T1,T2,T3); v: (T1,T2,T3)); extensionmethod := Object.ReferenceEquals(Self,nil) ? Object.ReferenceEquals(v,nil): Self.Equals(v); +function InternalEqual (x: (T1,T2,T3); y: (T1,T2,T3)): boolean; +begin + var xn := Object.ReferenceEquals(x,nil); + var yn := Object.ReferenceEquals(y,nil); + if xn then + Result := yn + else if yn then + Result := xn + else Result := x.Equals(y); +end; ///-- -function operator<> (Self: (T1,T2,T3); v: (T1,T2,T3)); extensionmethod := not (Self = v); +function operator= (x: (T1,T2,T3); y: (T1,T2,T3)); extensionmethod := InternalEqual(x,y); +///-- +function operator<> (x: (T1,T2,T3); y: (T1,T2,T3)); extensionmethod := not InternalEqual(x,y); ///-- function CompareToTup3(v1: (T1, T2, T3); v2: (T1, T2, T3)) := (v1 as System.IComparable).CompareTo(v2); ///-- @@ -10388,9 +10451,20 @@ function operator>(Self: (T1, T2, T3); v: (T1, T2, T3)); extensionmeth function operator>=(Self: (T1, T2, T3); v: (T1, T2, T3)); extensionmethod := CompareToTup3(Self, v) >= 0; ///-- -function operator= (Self: (T1,T2,T3,T4); v: (T1,T2,T3,T4)); extensionmethod := Object.ReferenceEquals(Self,nil) ? Object.ReferenceEquals(v,nil): Self.Equals(v); +function InternalEqual (x: (T1,T2,T3,T4); y: (T1,T2,T3,T4)): boolean; +begin + var xn := Object.ReferenceEquals(x,nil); + var yn := Object.ReferenceEquals(y,nil); + if xn then + Result := yn + else if yn then + Result := xn + else Result := x.Equals(y); +end; ///-- -function operator<> (Self: (T1,T2,T3,T4); v: (T1,T2,T3,T4)); extensionmethod := not (Self = v); +function operator= (x: (T1,T2,T3,T4); y: (T1,T2,T3,T4)); extensionmethod := InternalEqual(x,y); +///-- +function operator<> (x: (T1,T2,T3,T4); y: (T1,T2,T3,T4)); extensionmethod := not InternalEqual(x,y); ///-- function CompareToTup4(v1: (T1, T2, T3, T4); v2: (T1, T2, T3, T4)) := (v1 as System.IComparable).CompareTo(v2); ///-- @@ -10402,7 +10476,83 @@ function operator>(Self: (T1, T2, T3, T4); v: (T1, T2, T3, T4)); ex ///-- function operator>=(Self: (T1, T2, T3, T4); v: (T1, T2, T3, T4)); extensionmethod := CompareToTup4(Self, v) >= 0; +///-- +function InternalEqual (x: (T1,T2,T3,T4,T5); y: (T1,T2,T3,T4,T5)): boolean; +begin + var xn := Object.ReferenceEquals(x,nil); + var yn := Object.ReferenceEquals(y,nil); + if xn then + Result := yn + else if yn then + Result := xn + else Result := x.Equals(y); +end; +///-- +function operator= (x: (T1,T2,T3,T4,T5); y: (T1,T2,T3,T4,T5)); extensionmethod := InternalEqual(x,y); +///-- +function operator<> (x: (T1,T2,T3,T4,T5); y: (T1,T2,T3,T4,T5)); extensionmethod := not InternalEqual(x,y); +///-- +function CompareToTup5(v1: (T1, T2, T3, T4,T5); v2: (T1, T2, T3, T4,T5)) := (v1 as System.IComparable).CompareTo(v2); +///-- +function operator<(Self: (T1, T2, T3, T4,T5); v: (T1, T2, T3, T4,T5)); extensionmethod := CompareToTup5(Self, v) < 0; +///-- +function operator<=(Self: (T1, T2, T3, T4,T5); v: (T1, T2, T3, T4,T5)); extensionmethod := CompareToTup5(Self, v) <= 0; +///-- +function operator>(Self: (T1, T2, T3, T4,T5); v: (T1, T2, T3, T4,T5)); extensionmethod := CompareToTup5(Self, v) > 0; +///-- +function operator>=(Self: (T1, T2, T3, T4,T5); v: (T1, T2, T3, T4,T5)); extensionmethod := CompareToTup5(Self, v) >= 0; +///-- +function InternalEqual (x: (T1,T2,T3,T4,T5,T6); y: (T1,T2,T3,T4,T5,T6)): boolean; +begin + var xn := Object.ReferenceEquals(x,nil); + var yn := Object.ReferenceEquals(y,nil); + if xn then + Result := yn + else if yn then + Result := xn + else Result := x.Equals(y); +end; +///-- +function operator= (x: (T1,T2,T3,T4,T5,T6); y: (T1,T2,T3,T4,T5,T6)); extensionmethod := InternalEqual(x,y); +///-- +function operator<> (x: (T1,T2,T3,T4,T5,T6); y: (T1,T2,T3,T4,T5,T6)); extensionmethod := not InternalEqual(x,y); +///-- +function CompareToTup5(v1: (T1, T2, T3, T4,T5,T6); v2: (T1, T2, T3, T4,T5,T6)) := (v1 as System.IComparable).CompareTo(v2); +///-- +function operator<(Self: (T1, T2, T3, T4,T5,T6); v: (T1, T2, T3, T4,T5,T6)); extensionmethod := CompareToTup5(Self, v) < 0; +///-- +function operator<=(Self: (T1, T2, T3, T4,T5,T6); v: (T1, T2, T3, T4,T5,T6)); extensionmethod := CompareToTup5(Self, v) <= 0; +///-- +function operator>(Self: (T1, T2, T3, T4,T5,T6); v: (T1, T2, T3, T4,T5,T6)); extensionmethod := CompareToTup5(Self, v) > 0; +///-- +function operator>=(Self: (T1, T2, T3, T4,T5,T6); v: (T1, T2, T3, T4,T5,T6)); extensionmethod := CompareToTup5(Self, v) >= 0; + +///-- +function InternalEqual (x: (T1,T2,T3,T4,T5,T6,T7); y: (T1,T2,T3,T4,T5,T6,T7)): boolean; +begin + var xn := Object.ReferenceEquals(x,nil); + var yn := Object.ReferenceEquals(y,nil); + if xn then + Result := yn + else if yn then + Result := xn + else Result := x.Equals(y); +end; +///-- +function operator= (x: (T1,T2,T3,T4,T5,T6,T7); y: (T1,T2,T3,T4,T5,T6,T7)); extensionmethod := InternalEqual(x,y); +///-- +function operator<> (x: (T1,T2,T3,T4,T5,T6,T7); y: (T1,T2,T3,T4,T5,T6,T7)); extensionmethod := not InternalEqual(x,y); +///-- +function CompareToTup5(v1: (T1, T2, T3, T4,T5,T6,T7); v2: (T1, T2, T3, T4,T5,T6,T7)) := (v1 as System.IComparable).CompareTo(v2); +///-- +function operator<(Self: (T1, T2, T3, T4,T5,T6,T7); v: (T1, T2, T3, T4,T5,T6,T7)); extensionmethod := CompareToTup5(Self, v) < 0; +///-- +function operator<=(Self: (T1, T2, T3, T4,T5,T6,T7); v: (T1, T2, T3, T4,T5,T6,T7)); extensionmethod := CompareToTup5(Self, v) <= 0; +///-- +function operator>(Self: (T1, T2, T3, T4,T5,T6,T7); v: (T1, T2, T3, T4,T5,T6,T7)); extensionmethod := CompareToTup5(Self, v) > 0; +///-- +function operator>=(Self: (T1, T2, T3, T4,T5,T6,T7); v: (T1, T2, T3, T4,T5,T6,T7)); extensionmethod := CompareToTup5(Self, v) >= 0; // -------------------------------------------- // Методы расширения типа Tuple # Extension methods for Tuple // ------------------------------------------- diff --git a/bin/Lng/Eng/PascalABCParser.dat b/bin/Lng/Eng/PascalABCParser.dat index 35d442323..4055a1507 100644 --- a/bin/Lng/Eng/PascalABCParser.dat +++ b/bin/Lng/Eng/PascalABCParser.dat @@ -63,4 +63,5 @@ ONLY_BASE_ASSIGNMENT_FOR_TUPLE=Tuple allows only base assignment := BAD_FORMAT_STRING=Interpolated string has invalid format TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7=Count of Tuple elements must be <=7 TWO_NILS_IN_QUESTION_EXPR=The conditional expression cannot contain nil constants on both branches -DOT_QUECTION_IN_SHORT_FUN=Expression with ?. cannot appear in a short function definition without a return value \ No newline at end of file +DOT_QUECTION_IN_SHORT_FUN=Expression with ?. cannot appear in a short function definition without a return value +BAD_INT2=Too small int64 \ No newline at end of file diff --git a/bin/Lng/Rus/PascalABCParser.dat b/bin/Lng/Rus/PascalABCParser.dat index 9268ef221..06e76f75e 100644 --- a/bin/Lng/Rus/PascalABCParser.dat +++ b/bin/Lng/Rus/PascalABCParser.dat @@ -62,4 +62,5 @@ ONLY_BASE_ASSIGNMENT_FOR_TUPLE=Для кортежа допустимо толь BAD_FORMAT_STRING=Встречена неправильная форматная строка TUPLE_ELEMENTS_COUNT_MUST_BE_LESSEQUAL_7=Количество элементов кортежа не должно быть больше 7 TWO_NILS_IN_QUESTION_EXPR=Условное выражение не может содержать константы nil по обеим веткам -DOT_QUECTION_IN_SHORT_FUN=Выражение с ?. не может фигурировать в коротком определении функции без возвращаемого значения \ No newline at end of file +DOT_QUECTION_IN_SHORT_FUN=Выражение с ?. не может фигурировать в коротком определении функции без возвращаемого значения +BAD_INT2=Слишком маленькое целое diff --git a/bin/TestRunner.exe b/bin/TestRunner.exe index 09afeb86c..75e161fd8 100644 Binary files a/bin/TestRunner.exe and b/bin/TestRunner.exe differ