Исправление мелких ошибок NewSet

Все тесты проходят.

Проблема, которая остаётся - в режиме ускорения такие программы падают:

begin
  var s: set of byte;
  Print(s = [1]);
end.

Причина - из dll не вызывается конструктор записи без параметров, хотя он определён. В C# вообще у записей не может быть конструктора по умолчанию - наверное потому. Но для NewSet надо бы сделать исключение
This commit is contained in:
Mikhalkovich Stanislav 2024-11-19 13:56:47 +03:00
parent f8819665ba
commit d8262078f6
9 changed files with 29 additions and 17 deletions

View file

@ -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 = "3573";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%MINOR%=10
%REVISION%=3569
%REVISION%=3573
%COREVERSION%=0
%MAJOR%=3

View file

@ -1 +1 @@
3.10.0.3569
3.10.0.3573

View file

@ -1 +1 @@
!define VERSION '3.10.0.3569'
!define VERSION '3.10.0.3573'

View file

@ -567,6 +567,7 @@ end;
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);
@ -582,11 +583,11 @@ 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<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<byte>; b: NewSet<integer>); extensionmethod := b < a;
function operator>(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.IsProperSupersetOf(NSToInts64(b));
@ -686,11 +687,11 @@ begin
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;

View file

@ -15,7 +15,7 @@ assert([b,sh,sm,w,i,lw,li,ui]=[1,2,3,4,5,6,7,8]);
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.

View file

@ -1957,6 +1957,12 @@ namespace PascalABCCompiler.TreeRealization
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)
{
//Преобразуем найденный член класса.
@ -2227,9 +2233,13 @@ namespace PascalABCCompiler.TreeRealization
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;
}

View file

@ -567,6 +567,7 @@ end;
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);
@ -582,11 +583,11 @@ 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<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<byte>; b: NewSet<integer>); extensionmethod := b < a;
function operator>(a: NewSet<int64>; b: NewSet<integer>); extensionmethod := a._hs.IsProperSupersetOf(NSToInts64(b));
@ -686,11 +687,11 @@ begin
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;

Binary file not shown.