diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index a41bcb3da..08302bcde 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 = "9"; public const string Build = "0"; - public const string Revision = "3506"; + public const string Revision = "3510"; 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 b895f71e0..10d67c6cd 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %COREVERSION%=0 -%REVISION%=3506 +%REVISION%=3510 %MINOR%=9 %MAJOR%=3 diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index 1254af25c..31c149dc6 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.9.0.3506 +3.9.0.3510 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index f26103e3f..5ded403d5 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.9.0.3506' +!define VERSION '3.9.0.3510' diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index 8aae5adf4..1c9cff712 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -14467,7 +14467,14 @@ function operator>(Self: (T1, T2, T3, T4,T5,T6,T7); v: (T1 ///-- 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 implicit(a: array of T): set of T; extensionmethod; +begin + foreach var x in a do + Include(Result,x); +end; +} {// Определяет, есть ли указанный элемент в массиве function Contains(self: array of T; x: T): boolean; extensionmethod; diff --git a/TreeConverter/NetWrappers/NetHelper.cs b/TreeConverter/NetWrappers/NetHelper.cs index f86e07ba2..581c713cd 100644 --- a/TreeConverter/NetWrappers/NetHelper.cs +++ b/TreeConverter/NetWrappers/NetHelper.cs @@ -1115,17 +1115,36 @@ namespace PascalABCCompiler.NetHelper { List sil = scope.FindOnlyInType(op_name, scope); if(sil != null) + // что будет если два одинаковых преобразования? Может ли такое быть? foreach(SymbolInfo si in sil) { if (si.sym_info is common_namespace_function_node) { function_node fn = si.sym_info as function_node; - if ((fn.return_value_type == to || fn.return_value_type.original_generic == to - || to.type_special_kind == type_special_kind.array_kind && fn.return_value_type != null && fn.return_value_type.type_special_kind == type_special_kind.array_kind - && fn.return_value_type.element_type.is_generic_parameter) && - fn.parameters.Count == 1 && - (fn.parameters[0].type == from || fn.parameters[0].type.original_generic == from) - || fn.parameters[0].type.type_special_kind == type_special_kind.array_kind && fn.parameters[0].type.element_type.is_generic_parameter) + // SSM 17/07/24 Тут треш какой-то. fn - функция приведения типа. + if ( + // Тип возвращаемого значения fn совпадает с to + (fn.return_value_type == to || fn.return_value_type.original_generic == to + // Тут странное условие. to - это массив, fn.return_value_type - это массив и + // тип элемента этого массива - generic. То есть, это функция преобразования к array of T + // непонятно, можно ли тут двумерные массивы или просто system.array + || to.type_special_kind == type_special_kind.array_kind + && fn.return_value_type != null + && fn.return_value_type.type_special_kind == type_special_kind.array_kind + && fn.return_value_type.element_type.is_generic_parameter + ) + // Ну тут более менее понятно. Параметр у преобразования - один - + // и он в точности равен from + && fn.parameters.Count == 1 + && (fn.parameters[0].type == from || fn.parameters[0].type.original_generic == from) + // А тут самый главный треш. Мы преобразуем из массива. Почему то не проверяется уже, что + // количество параметров = 1. Ну ладно. Наверное это всегда так + // Но далее просто сказано, что это обобщенный массив. + // То есть, мы преобразуем из обобщенного массива array of T КУДА УГОДНО + // и вообще не сравниваем с to. В этом и ошибка! + //|| fn.parameters[0].type.type_special_kind == type_special_kind.array_kind + // && fn.parameters[0].type.element_type.is_generic_parameter + ) { return fn; } diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index 8aae5adf4..1c9cff712 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -14467,7 +14467,14 @@ function operator>(Self: (T1, T2, T3, T4,T5,T6,T7); v: (T1 ///-- 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 implicit(a: array of T): set of T; extensionmethod; +begin + foreach var x in a do + Include(Result,x); +end; +} {// Определяет, есть ли указанный элемент в массиве function Contains(self: array of T; x: T): boolean; extensionmethod;