From daf90c07d841240228de0f94338082a832e11e56 Mon Sep 17 00:00:00 2001 From: Ivan Bondarev Date: Mon, 25 Dec 2023 11:09:30 +0100 Subject: [PATCH] fix #2985 --- TestSuite/CompilationSamples/PABCSystem.pas | 12 ++++++++++++ TestSuite/string3.pas | 20 ++++++++++++++++++++ bin/Lib/PABCSystem.pas | 12 ++++++++++++ bin/Lib/PABCSystem.xml | 9 +++++++++ 4 files changed, 53 insertions(+) create mode 100644 TestSuite/string3.pas diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index ae61b86a1..d6e9d7af0 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -4242,6 +4242,18 @@ end; ///-- function string.operator+(str: string; n: integer) := str + n.ToString; +// Добавляет к строке str строковое представление числа n +///-- +function string.operator+(str: string; n: uint64) := str + n.ToString; + +// Добавляет к строке str строковое представление числа n +///-- +function string.operator+(str: string; n: int64) := str + n.ToString; + +// Добавляет к строке str строковое представление числа n +///-- +function string.operator+(str: string; n: longword) := str + n.ToString; + // Добавляет к строке str строковое представление числа n ///-- function string.operator+(n: integer; str: string) := n.ToString + str; diff --git a/TestSuite/string3.pas b/TestSuite/string3.pas new file mode 100644 index 000000000..6925e0670 --- /dev/null +++ b/TestSuite/string3.pas @@ -0,0 +1,20 @@ +var + x: uint64; + y: cardinal; + s: string; + +begin + x := 123456789012345; + s := 'x = ' + x; // x.ToString + assert(s = 'x = 123456789012345'); + y := 4000000000; + s := 'y = ' + y; // y.ToString + assert(s = 'y = 4000000000'); + var i := 4; + s := 'i = ' + i; // x.ToString + assert(s = 'i = 4'); + + var b := byte(4); + s := 'b = ' + b; // x.ToString + assert(s = 'b = 4'); +end. \ No newline at end of file diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index ae61b86a1..d6e9d7af0 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -4242,6 +4242,18 @@ end; ///-- function string.operator+(str: string; n: integer) := str + n.ToString; +// Добавляет к строке str строковое представление числа n +///-- +function string.operator+(str: string; n: uint64) := str + n.ToString; + +// Добавляет к строке str строковое представление числа n +///-- +function string.operator+(str: string; n: int64) := str + n.ToString; + +// Добавляет к строке str строковое представление числа n +///-- +function string.operator+(str: string; n: longword) := str + n.ToString; + // Добавляет к строке str строковое представление числа n ///-- function string.operator+(n: integer; str: string) := n.ToString + str; diff --git a/bin/Lib/PABCSystem.xml b/bin/Lib/PABCSystem.xml index 340fba69f..c206ca062 100644 --- a/bin/Lib/PABCSystem.xml +++ b/bin/Lib/PABCSystem.xml @@ -2746,6 +2746,15 @@ -- + + -- + + + -- + + + -- + --