Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pascalabcnet/pascalabcnet
Browse files Browse the repository at this point in the history
…into test
  • Loading branch information
BH_build_bot authored and BH_build_bot committed Nov 4, 2024
2 parents f3a3829 + fbd63ef commit 4bd7ccb
Show file tree
Hide file tree
Showing 14 changed files with 728 additions and 81 deletions.
2 changes: 1 addition & 1 deletion Configuration/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "3552";
public const string Revision = "3555";

public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;
Expand Down
4 changes: 2 additions & 2 deletions Configuration/Version.defs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%COREVERSION%=0
%REVISION%=3552
%MINOR%=10
%REVISION%=3555
%COREVERSION%=0
%MAJOR%=3
Binary file modified Localization/DefaultLang.resources
Binary file not shown.
4 changes: 2 additions & 2 deletions StringConstants/StringConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ public static string get_pointer_type_name_by_type_name(string type_name)
public static string subtract_of_set = "Subtract";
public static string in_set = "InSet";
public static string CreateSetProcedure = "CreateSet";
public static string IncludeProcedure = "Include";
public static string ExcludeProcedure = "Exclude";
//public static string IncludeProcedure = "Include";
//public static string ExcludeProcedure = "Exclude";
public static string DiapasonType = "Diapason";
public static string CreateDiapason = "CreateDiapason";
public static string CreateObjDiapason = "CreateObjDiapason";
Expand Down
2 changes: 1 addition & 1 deletion TestSuite/arrayofset2.pas
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const c : array of set of char = (['a','b'],[],['k','l']);
const c : array of set of char = (['a','b'],[],['k','l']);
var a : array of set of char := (['a','b'],[],['k','l']);
b : array of set of 1..4 := ([1,2,7],[2,3],[]);
d : array[1..3] of set of 1..4;
Expand Down
2 changes: 1 addition & 1 deletion TestSuite/nested2.pas
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type TClass = class
type TClass = class
procedure Meth;
end;

Expand Down
4 changes: 2 additions & 2 deletions TreeConverter/SystemLib/SystemLibInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,8 @@ public class initialization_properties
public static UnitDefinitionItem SetSubtractProcedure;
public static UnitDefinitionItem InSetProcedure;
public static UnitDefinitionItem CreateSetProcedure;
public static UnitDefinitionItem IncludeProcedure;
public static UnitDefinitionItem ExcludeProcedure;
//public static UnitDefinitionItem IncludeProcedure;
//public static UnitDefinitionItem ExcludeProcedure;
public static UnitDefinitionItem DiapasonType;
public static UnitDefinitionItem CreateDiapason;
public static UnitDefinitionItem CreateObjDiapason;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1893,7 +1893,9 @@ private void check_single_possible_convertion(ILocation loc,possible_type_conver
{
if (ptc.first.from is null_type_node || ptc.second.to == null || ptc.second.from is null_type_node || ptc.second.from.is_generic_parameter)
continue; // SSM 9/12/20 fix 2363
AddError(new PossibleTwoTypeConversionsInFunctionCall(loc,ptc.first,ptc.second));
if (ptc.first.from == ptc.second.from && ptc.first.to == ptc.second.to) // SSM fix 03/08/24 - непонятно, как до этого могло дойти
continue;
AddError(new PossibleTwoTypeConversionsInFunctionCall(loc,ptc.first,ptc.second));
}

}
Expand Down
270 changes: 203 additions & 67 deletions TreeConverter/TreeConversion/syntax_tree_visitor.cs

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion TreeConverter/TreeRealization/type_table.cs
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,8 @@ private static void add_conversion(possible_type_convertions ptc, function_node
}
else
{
ptc.second = new type_conversion(fn);
if (ptc.first.convertion_method != fn) // SSM 04/08/24 !!! - это когда есть op_implicit(Typ<integer>): Typ<byte>
ptc.second = new type_conversion(fn);
}
ptc.from = from;
ptc.to = to;
Expand Down
206 changes: 203 additions & 3 deletions bin/Lib/PABCExtensions.pas
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,9 @@ function SSet<T>(s: set of T): SortedSet<T>;
Result += x;
end;}

///--
function operator implicit(a: array of integer): set of integer; extensionmethod := TypedSet.InitBy(a);
{///--
function operator implicit(a: array of integer): set of integer; extensionmethod := TypedSet.InitBy(a);
///--
function operator implicit(a: array of real): set of real; extensionmethod := TypedSet.InitBy(a);
///--
function operator implicit(a: array of string): set of string; extensionmethod := TypedSet.InitBy(a);
Expand All @@ -433,9 +433,9 @@ 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<T>(a: array of T): set of T; extensionmethod := TypedSet.InitBy(a);
}

//------------------------------------------------------------------------------
// Операции для procedure
Expand All @@ -452,6 +452,206 @@ function operator*(n: integer; p: procedure): procedure; extensionmethod;
Result := () -> for var i:=1 to n do p
end;

// Важнейший для новых множеств !!!
procedure operator:=<T>(var Self: NewSet<T>; st: NewSet<T>); extensionmethod;
begin
Self._hs := new HashSet<T>(st.hs);
end;

// Extension-vtnjls для новых множеств
function operator implicit(n: NewSet<integer>): NewSet<byte>; extensionmethod;
begin
foreach var x in n._hs do
Result._hs.Add(x);
end;

function operator implicit(n: NewSet<integer>): NewSet<shortint>; extensionmethod;
begin
foreach var x in n._hs do
Result._hs.Add(x);
end;

function operator implicit(n: NewSet<integer>): NewSet<smallint>; extensionmethod;
begin
foreach var x in n._hs do
Result._hs.Add(x);
end;

function operator implicit(n: NewSet<integer>): NewSet<word>; extensionmethod;
begin
foreach var x in n._hs do
Result._hs.Add(x);
end;

function operator implicit(n: NewSet<integer>): NewSet<longword>; extensionmethod;
begin
foreach var x in n._hs do
Result._hs.Add(x);
end;

function operator implicit(n: NewSet<integer>): NewSet<int64>; extensionmethod;
begin
foreach var x in n._hs do
Result._hs.Add(x);
end;

function operator implicit(n: NewSet<integer>): NewSet<uint64>; extensionmethod;
begin
foreach var x in n._hs do
Result._hs.Add(x);
end;

function NSToInts(ns: NewSet<byte>) := ns._hs.Select(x -> integer(x));
function NSToInts(ns: NewSet<int64>) := ns._hs.Select(x -> integer(x));
function NSToInts64(ns: NewSet<byte>) := ns._hs.Select(x -> int64(x));
function NSToInts64(ns: NewSet<integer>) := ns._hs.Select(x -> int64(x));
function NSToBytes(ns: NewSet<integer>) := ns._hs.Select(x -> byte(x));
function NSToBytes(ns: NewSet<int64>) := ns._hs.Select(x -> byte(x));

// и для массивов столько же
function operator=(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.SetEquals(NSToInts(b));
function operator=(a: NewSet<byte>; b: NewSet<integer>): boolean; extensionmethod := b._hs.SetEquals(NSToInts(a));
function operator=(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.SetEquals(NSToInts64(b));
function operator=(a: NewSet<integer>; b: NewSet<int64>): boolean; extensionmethod := b._hs.SetEquals(NSToInts64(a));

function operator=(a: NewSet<integer>; b: array of byte); extensionmethod := a._hs.SetEquals(b.Select(x -> integer(x)));
function operator=(a: array of byte; b: NewSet<integer>): boolean; extensionmethod := b = a;
function operator=(a: array of int64; b: NewSet<integer>); extensionmethod := a.ToHashSet.SetEquals(NSToInts64(b));
function operator=(a: NewSet<integer>; b: array of int64): boolean; extensionmethod := b = a;

//function operator=(a: NewSet<int64>; b: NewSet<byte>); extensionmethod := a._hs.SetEquals(NSToInts64(b));
//function operator=(a: NewSet<byte>; b: NewSet<int64>): boolean; extensionmethod := a = b;

// Следующие функции предназначены для сравнения массива целых со множеством.
// Массив должен интерпретироваться как множество
// Не пойму - что использовать - эту строку или предыдущие. Все типы массивов сравнивать с NewSet<integer>
// или наоборот все типы множеств - с array of integer
function operator=(a: NewSet<byte>; b: array of integer): boolean; extensionmethod := NSToInts(a).ToHashSet.SetEquals(b);

function operator<>(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := not(a = b);
function operator<>(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := not(a = b);
function operator<>(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := not(a = b);
function operator<>(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := not(a = b);
//function operator<>(a: NewSet<int64>; b: NewSet<byte>); extensionmethod := not(a = b);
//function operator<>(a: NewSet<byte>; b: NewSet<int64>); extensionmethod := not(a = b);

function operator<(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.IsProperSubsetOf(NSToInts(b));
function operator<(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.IsProperSubsetOf(NSToInts64(b));
//function operator<(a: NewSet<int64>; b: NewSet<byte>); extensionmethod := a._hs.IsProperSubsetOf(NSToInts64(b));

function operator>(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.IsProperSupersetOf(NSToInts(b));
function operator>(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.IsProperSupersetOf(NSToInts64(b));
//function operator>(a: NewSet<int64>; b: NewSet<byte>); extensionmethod := a._hs.IsProperSupersetOf(NSToInts64(b));

function operator<(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := b > a;
function operator<(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := b > a;
//function operator<(a: NewSet<byte>; b: NewSet<int64>); extensionmethod := b > a;

function operator>(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := b < a;
function operator>(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := b < a;
//function operator>(a: NewSet<byte>; b: NewSet<int64>); extensionmethod := b < a;

function operator<=(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.IsSubsetOf(NSToInts(b));
function operator<=(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.IsSubsetOf(NSToInts64(b));
//function operator<=(a: NewSet<int64>; b: NewSet<byte>); extensionmethod := a._hs.IsSubsetOf(NSToInts64(b));

function operator>=(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.IsSupersetOf(NSToInts(b));
function operator>=(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.IsSupersetOf(NSToInts64(b));
//function operator>=(a: NewSet<int64>; b: NewSet<byte>); extensionmethod := a._hs.IsSupersetOf(NSToInts64(b));

function operator<=(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := b >= a;
function operator<=(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := b >= a;
//function operator<(a: NewSet<byte>; b: NewSet<int64>); extensionmethod := b >= a;

function operator>=(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := b <= a;
function operator>=(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := b <= a;
//function operator>(a: NewSet<byte>; b: NewSet<int64>); extensionmethod := b <= a;

procedure operator*=(var a: NewSet<byte>; b: NewSet<integer>); extensionmethod := a._hs.IntersectWith(NSToBytes(b));
procedure operator*=(var a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.IntersectWith(NSToInts(b));
procedure operator*=(var a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.IntersectWith(NSToInts64(b));
procedure operator*=(var a: NewSet<integer>; b: NewSet<int64>); extensionmethod := a._hs.IntersectWith(NSToInts(b));

//procedure operator*=(var a: NewSet<byte>; b: NewSet<int64>); extensionmethod := a._hs.IntersectWith(NSToBytes(b));
//procedure operator*=(var a: NewSet<int64>; b: NewSet<byte>); extensionmethod := a._hs.IntersectWith(NSToInts64(b));
procedure operator+=(var a: NewSet<byte>; b: NewSet<integer>); extensionmethod := a._hs.UnionWith(NSToBytes(b));
procedure operator+=(var a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.UnionWith(NSToInts(b));
procedure operator+=(var a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.UnionWith(NSToInts64(b));
procedure operator+=(var a: NewSet<integer>; b: NewSet<int64>); extensionmethod := a._hs.UnionWith(NSToInts(b));
procedure operator+=(var a: NewSet<byte>; b: NewSet<int64>); extensionmethod := a._hs.UnionWith(NSToBytes(b));
procedure operator+=(var a: NewSet<int64>; b: NewSet<byte>); extensionmethod := a._hs.UnionWith(NSToInts64(b));

procedure operator-=(var a: NewSet<byte>; b: NewSet<integer>); extensionmethod := a._hs.ExceptWith(NSToBytes(b));
procedure operator-=(var a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.ExceptWith(NSToInts(b));
procedure operator-=(var a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.ExceptWith(NSToInts64(b));
procedure operator-=(var a: NewSet<integer>; b: NewSet<int64>); extensionmethod := a._hs.ExceptWith(NSToInts(b));


// Нет операции между set of byte и set of int64. Один из операндов должен быть set of integer
function operator*(a: NewSet<integer>; b: NewSet<byte>): NewSet<integer>; extensionmethod;
begin
Result += a; Result *= b
end;

function operator*(a: NewSet<byte>; b: NewSet<integer>): NewSet<integer>; extensionmethod;
begin
Result += a; Result *= b
end;

function operator*(a: NewSet<integer>; b: NewSet<int64>): NewSet<int64>; extensionmethod;
begin
Result += a; Result *= b
end;

function operator*(a: NewSet<int64>; b: NewSet<integer>): NewSet<int64>; extensionmethod;
begin
Result += a; Result *= b
end;
//-----

function operator+(a: NewSet<integer>; b: NewSet<byte>): NewSet<integer>; extensionmethod;
begin
Result += a; Result += b
end;

function operator+(a: NewSet<byte>; b: NewSet<integer>): NewSet<integer>; extensionmethod;
begin
Result += a; Result += b
end;

function operator+(a: NewSet<integer>; b: NewSet<int64>): NewSet<int64>; extensionmethod;
begin
Result += a; Result += b
end;

function operator+(a: NewSet<int64>; b: NewSet<integer>): NewSet<int64>; extensionmethod;
begin
Result += a; Result += b
end;

//-----
function operator-(a: NewSet<integer>; b: NewSet<byte>): NewSet<integer>; extensionmethod;
begin
Result += a; Result -= b
end;

function operator-(a: NewSet<byte>; b: NewSet<integer>): NewSet<integer>; extensionmethod;
begin
Result += a; Result -= b
end;

function operator-(a: NewSet<integer>; b: NewSet<int64>): NewSet<int64>; extensionmethod;
begin
Result += a; Result -= b
end;

function operator-(a: NewSet<int64>; b: NewSet<integer>): NewSet<int64>; extensionmethod;
begin
Result += a; Result -= b
end;



var __initialized: boolean;

{procedure __InitModule;
Expand Down
Loading

0 comments on commit 4bd7ccb

Please sign in to comment.