From 53b3fd0881c7097420323b35955687919cd3f5c6 Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Wed, 9 Oct 2024 14:09:01 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=BD=D0=BE=D0=B5=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B5=D0=BE=D0=B1=D1=80=D0=B0=D0=B7=D0=BE=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=82=20array=20of=20T=20=D0=B2=20s?= =?UTF-8?q?et=20of=20T?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Configuration/GlobalAssemblyInfo.cs | 2 +- Configuration/Version.defs | 4 ++-- Release/pabcversion.txt | 2 +- ReleaseGenerators/PascalABCNET_version.nsh | 2 +- .../CompilationSamples/PABCExtensions.pas | 2 ++ TreeConverter/NetWrappers/NetHelper.cs | 23 +++++++++++++++++++ bin/Lib/PABCExtensions.pas | 2 ++ 7 files changed, 32 insertions(+), 5 deletions(-) diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 3f7ef19e1..039e0020d 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 = "10"; public const string Build = "0"; - public const string Revision = "3550"; + public const string Revision = "3551"; 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 5a3b6930a..a7c9a2668 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%COREVERSION%=0 -%REVISION%=3550 %MINOR%=10 +%REVISION%=3551 +%COREVERSION%=0 %MAJOR%=3 diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index 64d0cbea7..97f582fa8 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.10.0.3550 +3.10.0.3551 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index a3a65e25e..7acc9fa20 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.10.0.3550' +!define VERSION '3.10.0.3551' diff --git a/TestSuite/CompilationSamples/PABCExtensions.pas b/TestSuite/CompilationSamples/PABCExtensions.pas index 306d448d2..0a5fd23c9 100644 --- a/TestSuite/CompilationSamples/PABCExtensions.pas +++ b/TestSuite/CompilationSamples/PABCExtensions.pas @@ -433,6 +433,8 @@ function operator implicit(a: array of BigInteger): set of BigInteger; extension function operator implicit(a: array of decimal): set of decimal; extensionmethod := TypedSet.InitBy(a); ///-- function operator implicit(a: array of single): set of single; extensionmethod := TypedSet.InitBy(a); +///-- +function operator implicit(a: array of T): set of T; extensionmethod := TypedSet.InitBy(a); //------------------------------------------------------------------------------ // Операции для procedure diff --git a/TreeConverter/NetWrappers/NetHelper.cs b/TreeConverter/NetWrappers/NetHelper.cs index 33a608ef1..d866e9dfc 100644 --- a/TreeConverter/NetWrappers/NetHelper.cs +++ b/TreeConverter/NetWrappers/NetHelper.cs @@ -1152,11 +1152,34 @@ namespace PascalABCCompiler.NetHelper fn.parameters[0].type.type_special_kind == type_special_kind.array_kind && fn.parameters[0].type.element_type.is_generic_parameter && fn.parameters.Count == 1 + // Вот это условие для set of T должно удовлетвориться и тогда всё будет работать! && (fn.return_value_type == to || fn.return_value_type.original_generic == to) ) { return fn; } + // А теперь конкретно для преобразования array of T в set of T !!! Надо переделывать. Позже + if ( + fn.parameters[0].type.type_special_kind == type_special_kind.array_kind + && fn.parameters[0].type.element_type.is_generic_parameter + && fn.parameters.Count == 1 + && to is common_type_node ctn && ctn.type_special_kind == type_special_kind.set_type + ) + { + List instance_params = new List(); + + instance_params.Add(ctn.element_type); // Это должен быть конкретный тип + var fn1 = fn.get_instance(instance_params, false, null); + if ( + fn1.return_value_type == to || fn1.return_value_type.original_generic == to + ) + { + // Вернуть тем не менее fn! Во внешнем коде он тоже инстанцируется! + // Это обязательно надо переделывать! + return fn; + } + } + } } } diff --git a/bin/Lib/PABCExtensions.pas b/bin/Lib/PABCExtensions.pas index add1e5b3b..2f47a11ac 100644 --- a/bin/Lib/PABCExtensions.pas +++ b/bin/Lib/PABCExtensions.pas @@ -433,6 +433,8 @@ function operator implicit(a: array of BigInteger): set of BigInteger; extension function operator implicit(a: array of decimal): set of decimal; extensionmethod := TypedSet.InitBy(a); ///-- function operator implicit(a: array of single): set of single; extensionmethod := TypedSet.InitBy(a); +///-- +function operator implicit(a: array of T): set of T; extensionmethod := TypedSet.InitBy(a); //------------------------------------------------------------------------------ // Операции для procedure