Skip to content

Commit

Permalink
Merge branch 'pascalabcnet:master' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
spectatorBH authored Nov 19, 2024
2 parents a3bdd42 + 206289c commit 28c222a
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 94 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 = "3569";
public const string Revision = "3574";

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 @@
%MINOR%=10
%REVISION%=3569
%COREVERSION%=0
%REVISION%=3574
%MINOR%=10
%MAJOR%=3
2 changes: 1 addition & 1 deletion Release/pabcversion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.10.0.3569
3.10.0.3574
2 changes: 1 addition & 1 deletion ReleaseGenerators/PascalABCNET_version.nsh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
!define VERSION '3.10.0.3569'
!define VERSION '3.10.0.3574'
72 changes: 38 additions & 34 deletions TestSuite/CompilationSamples/PABCExtensions.pas
Original file line number Diff line number Diff line change
Expand Up @@ -532,25 +532,25 @@ function NSToBytes(ns: NewSet<integer>) := ns._hs.Select(x -> byte(x));
function NSToBytes(ns: NewSet<int64>) := ns._hs.Select(x -> byte(x));

// Надо set of integer со всеми
function operator=(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.SetEquals(NSToInts(b));
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 = a;
function operator=(a: NewSet<integer>; b: NewSet<shortint>); extensionmethod := a._hs.SetEquals(NSToInts(b));
function operator=(a: NewSet<integer>; b: NewSet<shortint>); extensionmethod := a.hs.SetEquals(NSToInts(b));
function operator=(a: NewSet<shortint>; b: NewSet<integer>): boolean; extensionmethod := b = a;
function operator=(a: NewSet<integer>; b: NewSet<smallint>); extensionmethod := a._hs.SetEquals(NSToInts(b));
function operator=(a: NewSet<integer>; b: NewSet<smallint>); extensionmethod := a.hs.SetEquals(NSToInts(b));
function operator=(a: NewSet<smallint>; b: NewSet<integer>): boolean; extensionmethod := b = a;
function operator=(a: NewSet<integer>; b: NewSet<word>); extensionmethod := a._hs.SetEquals(NSToInts(b));
function operator=(a: NewSet<integer>; b: NewSet<word>); extensionmethod := a.hs.SetEquals(NSToInts(b));
function operator=(a: NewSet<word>; b: NewSet<integer>): boolean; extensionmethod := b = a;

// В этом случае integer и longword не вкладываются друг в друга
function operator=(a: NewSet<integer>; b: NewSet<longword>): boolean; extensionmethod;
begin
var hsInt64: HashSet<int64>;
hsInt64 := new HashSet<int64>(b._hs.Select(x -> int64(x)));
Result := hsInt64.SetEquals(a._hs.Select(x -> int64(x)));
hsInt64 := new HashSet<int64>(b.hs.Select(x -> int64(x)));
Result := hsInt64.SetEquals(a.hs.Select(x -> int64(x)));
end;

function operator=(a: NewSet<longword>; b: NewSet<integer>): boolean; extensionmethod := b = a;
function operator=(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.SetEquals(NSToInts64(b));
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 = a;

// Здесь оба типа нельзя расширить до общего типа, и есть проблема
Expand All @@ -567,6 +567,7 @@ function operator=(a: NewSet<integer>; b: NewSet<uint64>): boolean; extensionmet

function operator=(a: NewSet<uint64>; b: NewSet<integer>): boolean; extensionmethod := b = a;


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<integer>; b: NewSet<shortint>); extensionmethod := not(a = b);
Expand All @@ -582,44 +583,47 @@ function operator<>(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := no
function operator<>(a: NewSet<integer>; b: NewSet<uint64>); extensionmethod := not(a = b);
function operator<>(a: NewSet<uint64>; b: NewSet<integer>); extensionmethod := not(a = b);

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

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

function operator>=(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a._hs.IsSupersetOf(NSToInts(b));
function operator>=(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a.hs.IsSupersetOf(NSToInts(b));
function operator>=(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := b <= a;
function operator>=(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.IsSupersetOf(NSToInts64(b));
function operator>=(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a.hs.IsSupersetOf(NSToInts64(b));
function operator>=(a: NewSet<integer>; 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<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<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+=<T>(var a: NewSet<T>; another: NewSet<T>); extensionmethod := a.hs.UnionWith(another.hs);

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));
procedure operator+=(a: NewSet<byte>; b: NewSet<integer>); extensionmethod := a.hs.UnionWith(NSToBytes(b));
procedure operator+=(a: NewSet<integer>; b: NewSet<byte>); extensionmethod := a.hs.UnionWith(NSToInts(b));
procedure operator+=(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a.hs.UnionWith(NSToInts64(b));
//procedure operator+=(a: NewSet<integer>; b: NewSet<int64>); extensionmethod := a.hs.UnionWith(NSToInts(b));
procedure operator+=(a: NewSet<byte>; b: NewSet<int64>); extensionmethod := a.hs.UnionWith(NSToBytes(b));
procedure operator+=(a: NewSet<int64>; b: NewSet<byte>); extensionmethod := a.hs.UnionWith(NSToInts64(b));

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


// Нет операции между set of byte и set of int64. Один из операндов должен быть set of integer
Expand Down Expand Up @@ -686,11 +690,11 @@ function operator-(a: NewSet<int64>; b: NewSet<integer>): NewSet<int64>; extensi
end;

// и для массивов столько же
function operator=(a: NewSet<integer>; b: array of byte); extensionmethod := a._hs.SetEquals(b.Select(x -> integer(x)));
(*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;

Expand Down
16 changes: 8 additions & 8 deletions TestSuite/CompilationSamples/PABCSystem.pas
Original file line number Diff line number Diff line change
Expand Up @@ -526,15 +526,15 @@ NewSet<T> = record(IEnumerable<T>)
static procedure operator*=(Self, another: NewSet<T>) := Self.hs.IntersectWith(another.hs);
static function operator+(first, second: NewSet<T>): NewSet<T>;
begin
Result += first; Result += second;
Result.hs.UnionWith(first); Result._hs.UnionWith(second);
end;
static function operator*(first, second: NewSet<T>): NewSet<T>;
begin
Result += first; Result *= second;
Result.hs.UnionWith(first); Result._hs.IntersectWith(second);
end;
static function operator-(first, second: NewSet<T>): NewSet<T>;
begin
Result += first; Result -= second;
Result.hs.UnionWith(first); Result.hs.ExceptWith(second);
end;
static function operator=(first, second: NewSet<T>) := first.hs.SetEquals(second.hs);
static function operator<>(first, second: NewSet<T>) := not (first = second);
Expand All @@ -550,7 +550,7 @@ NewSet<T> = record(IEnumerable<T>)
end;

static function operator implicit(ns: NewSetEmpty): NewSet<T>; begin end;
static function operator:=(var s: NewSet<T>; st: NewSet<T>): NewSet<T>;
static function operator:=(var s: NewSet<T>; st: NewSet<T>): NewSet<T>; // Эту функцию обязательно здесь определять
begin
s._hs := new HashSet<T>(st.hs);
end;
Expand All @@ -577,11 +577,11 @@ NewSetEmpty = class
static function operator*(first, second: NewSetEmpty): NewSetEmpty := new NewSetEmpty;
static function operator+<T>(first: NewSetEmpty; second: array of T): NewSet<T>;
begin
Result._hs.UnionWith(second);
Result.hs.UnionWith(second);
end;
static function operator+<T>(first: array of T; second: NewSetEmpty): NewSet<T>;
begin
Result._hs.UnionWith(first);
Result.hs.UnionWith(first);
end;
static function operator+<T>(first: NewSet<T>; second: NewSetEmpty): NewSet<T> := first;
static function operator+<T>(first: NewSetEmpty; second: NewSet<T>): NewSet<T> := second;
Expand All @@ -595,7 +595,7 @@ NewSetEmpty = class
static function operator-<T>(first: NewSetEmpty; second: array of T): NewSet<T>; begin end;
static function operator-<T>(first: array of T; second: NewSetEmpty): NewSet<T>;
begin
Result._hs.UnionWith(first);
Result.hs.UnionWith(first);
end;
function ToString: string; override := '{}';
function ToSet<T>(): NewSet<T>; begin end;
Expand Down Expand Up @@ -15413,7 +15413,7 @@ function EmptySet := _emptyset;
[SetCreatorFunction]
function __NewSetCreatorInternal<T>(params a: array of T): NewSet<T>;
begin
Result._hs := new HashSet<T>;
//Result._hs := new HashSet<T>;
Result._hs.UnionWith(a);
end;

Expand Down
4 changes: 2 additions & 2 deletions TestSuite/set7.pas
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Include(s1,integer.MaxValue);
s1.Add(longword.MaxValue);
//s1 += [longword.MaxValue];
s1 += [int64.MaxValue,uint64.MaxValue];
assert(s1=[integer.MaxValue,longword.MaxValue,int64.MaxValue,uint64.MaxValue]);
//s1 += [int64.MaxValue,uint64.MaxValue];
//assert(s1=[integer.MaxValue,longword.MaxValue,int64.MaxValue,uint64.MaxValue]);
s1 := [byte.MaxValue,shortint.MaxValue,smallint.MaxValue,word.MaxValue,integer.MaxValue,longword.MaxValue,int64.MaxValue,uint64.MaxValue];
end.
16 changes: 13 additions & 3 deletions TreeConverter/TreeRealization/generics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,12 @@ public generic_instance_type_node find_instance_type_from(type_node orig_type)
public definition_node ConvertMember(definition_node orig_node)
{
definition_node rez_node = _members[orig_node] as definition_node;
/*if ((rez_node != null) && this.BaseFullName == "PABCSystem.NewSet`1" && orig_node is compiled_function_node cfn2
&& cfn2.name == "op_Equality")
{
rez_node = null;
_members.Remove(orig_node); // ну так себе метод - сколько операций = столько и будет удаляться и повторно создаваться :)
}*/
if (rez_node == null)
{
//Преобразуем найденный член класса.
Expand Down Expand Up @@ -2227,9 +2233,13 @@ private void conform_basic_function(string name, int base_func_num)

public void conform_basic_functions()
{
conform_basic_function(StringConstants.assign_name, 0);
conform_basic_function(StringConstants.eq_name, 1);
conform_basic_function(StringConstants.noteq_name, 2);
// Вообще говоря, надо эти операции добавлять только если пользовательские не определены
if (BaseFullName != "PABCSystem.NewSet`1") // SSM 19/11/24 - для типа встроенных множеств где эти операции переопределены
{
conform_basic_function(StringConstants.assign_name, 0);
conform_basic_function(StringConstants.eq_name, 1);
conform_basic_function(StringConstants.noteq_name, 2);
}
temp_names = null;
}

Expand Down
Loading

0 comments on commit 28c222a

Please sign in to comment.