Добавил временное преобразование от array of T в set of T

This commit is contained in:
Mikhalkovich Stanislav 2024-10-09 14:09:01 +03:00
parent 271d5792ce
commit 53b3fd0881
7 changed files with 32 additions and 5 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 = "3550";
public const string Revision = "3551";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%COREVERSION%=0
%REVISION%=3550
%MINOR%=10
%REVISION%=3551
%COREVERSION%=0
%MAJOR%=3

View file

@ -1 +1 @@
3.10.0.3550
3.10.0.3551

View file

@ -1 +1 @@
!define VERSION '3.10.0.3550'
!define VERSION '3.10.0.3551'

View file

@ -433,6 +433,8 @@ 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

View file

@ -1152,11 +1152,34 @@ namespace PascalABCCompiler.NetHelper
fn.parameters[0].type.type_special_kind == type_special_kind.array_kind
&& fn.parameters[0].type.element_type.is_generic_parameter
&& fn.parameters.Count == 1
// Вот это условие для set of T должно удовлетвориться и тогда всё будет работать!
&& (fn.return_value_type == to || fn.return_value_type.original_generic == to)
)
{
return fn;
}
// А теперь конкретно для преобразования array of T в set of T !!! Надо переделывать. Позже
if (
fn.parameters[0].type.type_special_kind == type_special_kind.array_kind
&& fn.parameters[0].type.element_type.is_generic_parameter
&& fn.parameters.Count == 1
&& to is common_type_node ctn && ctn.type_special_kind == type_special_kind.set_type
)
{
List<type_node> instance_params = new List<type_node>();
instance_params.Add(ctn.element_type); // Это должен быть конкретный тип
var fn1 = fn.get_instance(instance_params, false, null);
if (
fn1.return_value_type == to || fn1.return_value_type.original_generic == to
)
{
// Вернуть тем не менее fn! Во внешнем коде он тоже инстанцируется!
// Это обязательно надо переделывать!
return fn;
}
}
}
}
}

View file

@ -433,6 +433,8 @@ 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