Immutable empty array, can be used to avoid repeated allocations.
Immutable empty IndexedSeq, can be used to avoid repeated allocations.
All pre-defined types should be listed here.
All pre-defined types should be listed here. Note, NoType is not listed. Should be in sync with sigmastate.lang.Types.predefTypes.
Named type variables and parameters used in generic types and method signatures.
Named type variables and parameters used in generic types and method signatures.
Generic type terms like (Coll[IV],(IV) => Boolean) => Boolean
are used to represent
method types of Coll
and
Option
in the example above) STypeVar instances
are used. types. Each such type is an instance of SFunc.
To represent variables (such as
IV
Generic types are not supported by ErgoTree serialization format and STypeVars are used internally and never serialized (there is no serializer for STypeVar). Thus the usage of type variables is limited.
All necessary type variables can be declared in advance and reused across all code base. This allows to avoid allocation of many duplicates and also improve performance of SType values.
A mapping of object types supporting MethodCall operations.
A mapping of object types supporting MethodCall operations. For each serialized typeId this map contains a companion object which can be used to access the list of corresponding methods.
NOTE: in the current implementation only monomorphic methods are supported (without type parameters)
NOTE2: in v3.x SNumericType.typeId is silently shadowed by SGlobal.typeId as part of
toMap
operation. As a result, the methods collected into SByte.methods cannot be
resolved (using SMethod.fromIds()) for all numeric types (SByte, SShort, SInt,
SLong, SBigInt). See the corresponding regression property("MethodCall on numerics")
.
However, this "shadowing" is not a problem since all casting methods are implemented
via Downcast, Upcast opcodes and the remaining toBytes
, toBits
methods are not
implemented at all.
In order to allow MethodCalls on numeric types in future versions the SNumericType.typeId
should be changed and SGlobal.typeId should be preserved. The regression tests in
property("MethodCall Codes")
should pass.