diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 459ace208..d12e4d008 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 = "2"; - public const string Revision = "2002"; + public const string Revision = "2003"; 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 11fc31240..01e9b3ab2 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%MINOR%=4 -%REVISION%=2002 %COREVERSION%=2 +%REVISION%=2003 +%MINOR%=4 %MAJOR%=3 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 23129d8b0..858d3fd8d 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.4.2.2002' +!define VERSION '3.4.2.2003' diff --git a/TestSuite/Set_char_string.pas b/TestSuite/Set_char_string.pas new file mode 100644 index 000000000..1c3c4ac7f --- /dev/null +++ b/TestSuite/Set_char_string.pas @@ -0,0 +1,5 @@ +begin + var s: set of string := ['b','d ']; + foreach var o in s do + Assert(o.GetType = typeof(string)); +end. \ No newline at end of file diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index c87e8a9ff..b2c53e295 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -4842,8 +4842,6 @@ namespace PascalABCCompiler.TreeConverter types.AddElement(en.type); } } - expressions_list consts_copy = new expressions_list(); - consts_copy.AddRange(consts); type_node ctn = null; if (consts.Count > 0) { @@ -4855,7 +4853,22 @@ namespace PascalABCCompiler.TreeConverter } else ctn = SystemLibrary.SystemLibInitializer.TypedSetType.sym_info as type_node; + + /*if (el_type == SystemLibrary.SystemLibrary.string_type) + { + for (int i = 0; i < consts.Count; i++) + if (consts[i].type == SystemLibrary.SystemLibrary.char_type) + { + consts[i] = convertion_data_and_alghoritms.convert_type(consts[i], el_type); + } + } */ // Не работает ! SSM 19.03.19 + + expressions_list consts_copy = new expressions_list(); + consts_copy.AddRange(consts); + function_node fn = convertion_data_and_alghoritms.select_function(consts, SystemLibrary.SystemLibInitializer.CreateSetProcedure.SymbolInfo, (SystemLibrary.SystemLibInitializer.CreateSetProcedure.sym_info is common_namespace_function_node)?(SystemLibrary.SystemLibInitializer.CreateSetProcedure.sym_info as common_namespace_function_node).loc:null); + + if (fn is common_namespace_function_node) { common_namespace_function_call cnfc = new common_namespace_function_call(fn as common_namespace_function_node, get_location(_pascal_set_constant)); diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index fd53256ce..4272c192e 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -3031,7 +3031,7 @@ begin Result.high := high; end; -[System.Diagnostics.DebuggerStepThrough] +//[System.Diagnostics.DebuggerStepThrough] function CreateObjDiapason(low, high: object): Diapason; begin Result.clow := low; @@ -3041,9 +3041,39 @@ end; [System.Diagnostics.DebuggerStepThrough] function CreateSet(params elems: array of object): TypedSet; begin + var chars := false; + var strings := false; + var others := false; + foreach var x in elems do + begin + if (x is char) or (x is Diapason) and (Diapason(x).clow is char) then + chars := true + else if x is string then + strings := true + else + begin + others := true; + break + end; + end; + Result := new TypedSet(); - for var i := 0 to elems.Length - 1 do - Result.IncludeElement(elems[i]); + + if chars and strings and not others then + foreach var x in elems do + if x is char then + Result.IncludeElement(x.ToString) + else if (x is Diapason) and (Diapason(x).clow is char) then + begin + var c1 := char(Diapason(x).clow); + var c2 := char(Diapason(x).chigh); + for var cc := c1 to c2 do + Result.IncludeElement(cc.ToString) + end + else Result.IncludeElement(x) + else + foreach var x in elems do + Result.IncludeElement(x); end; [System.Diagnostics.DebuggerStepThrough]