Types¶
This section contains definitions declared in the chpl::types namespace.
-
namespace chpl::types¶
Functions
-
size_t hashSubstitutionsMap(const CompositeType::SubstitutionsMap &subs)¶
-
void stringifySubstitutionsMap(std::ostream &streamOut, StringifyKind stringKind, const CompositeType::SubstitutionsMap &subs)¶
-
class AnyType : public chpl::types::Type¶
- #include <AnyType.h>
This class represents a generic type that can instantiate to any type.
Public Functions
-
~AnyType() = default¶
-
~AnyType() = default¶
-
class BasicClassType : public chpl::types::CompositeType¶
- #include <BasicClassType.h>
This class represents an class type (e.g.
class C
) without considering decorators.Public Functions
-
~BasicClassType() = default¶
-
inline const BasicClassType *parentClassType() const¶
Return the parent class type, or nullptr if this is the ‘object’ type.
-
inline bool isObjectType() const¶
Return true if this type is the ‘object’ type.
-
bool isSubtypeOf(const BasicClassType *parentType, bool &converts, bool &instantiates) const¶
Returns true if this class type is a subclass of the passed parent class type or an instantiation of a passed generic class type or a combination of the two.
The argument ‘convert’ is set to true if passing required using a parent type and ‘instantiates’ is set to true if it requires instantiation.
-
inline const BasicClassType *instantiatedFrom() const¶
If this type represents an instantiated type, returns the type it was instantiated from.
This is just instantiatedFromCompositeType() with the result cast to BasicClassType.
Public Static Functions
-
static const BasicClassType *get(Context *context, ID id, UniqueString name, const BasicClassType *parentType, const BasicClassType *instantiatedFrom, CompositeType::SubstitutionsMap subs)¶
-
static const BasicClassType *getObjectType(Context *context)¶
-
~BasicClassType() = default¶
-
class BoolType : public chpl::types::PrimitiveType¶
- #include <BoolType.h>
This class represents a bool type, e.g.
bool
orbool(32)
.Note that
bool
normally has width8
butbool(8)
is a separate type.Public Functions
-
~BoolType() = default¶
-
inline virtual int bitwidth() const override¶
Returns the bit width selected for numeric types. Returns 8 for the default sized bool.
-
inline virtual bool isDefaultWidth() const override¶
Returns true if this PrimitiveType has the default width.
-
inline virtual const char *c_str() const override¶
Returns a C string for the name of this PrimitiveType.
-
inline bool isDefaultBool() const¶
Returns
true
if this is the typebool
which is distinct frombool(8)
.
-
~BoolType() = default¶
-
class BuiltinType : public chpl::types::Type¶
- #include <BuiltinType.h>
This class represents a builtin type that only needs a name to be used by resolution.
For example,
numeric
,borrowed
,chpl_anyreal
.Types that are used very commonly (e.g. AnyType, UnknownType) should get their own classes.
Types that have need for different fields (e.g. PrimitiveType) should get their own classes.
Public Functions
-
~BuiltinType() = default¶
-
const char *c_str() const¶
Returns a C string for the name of this BuiltinType.
Public Static Functions
-
static void gatherBuiltins(Context *context, std::unordered_map<UniqueString, const Type*> &map)¶
-
~BuiltinType() = default¶
-
class ClassType : public chpl::types::Type¶
- #include <ClassType.h>
This class represents an class type including a memory management decorator. E.g. if we have
class C
, thenborrowed C?
orshared C
are ClassTypes.Public Functions
-
~ClassType() = default¶
-
virtual void stringify(std::ostream &ss, chpl::StringifyKind stringKind) const override¶
-
inline ClassTypeDecorator decorator() const¶
Returns the ClassTypeDecorator for this ClassType. This decorator indicates the memory management strategy.
-
inline const Type *manager() const¶
Returns the manager for this ClassType, or nullptr if the decorator does not indicate a managed type. This can return a record type or AnyOwnedType / AnySharedType.
-
inline const BasicClassType *basicClassType() const¶
Returns the basic class type
-
const ClassType *withDecorator(Context *context, ClassTypeDecorator decorator) const¶
Returns the version of this ClassType with the passed decorator
Public Static Functions
-
static const ClassType *get(Context *context, const BasicClassType *basicType, const Type *manager, ClassTypeDecorator decorator)¶
-
~ClassType() = default¶
-
class ClassTypeDecorator¶
- #include <ClassTypeDecorator.h>
This class stores a class type decorator that describes a memory management strategy.
It wraps a ClassTypeDecoratorEnum value so that it is easy to call methods on it.
Public Types
-
enum ClassTypeDecoratorEnum¶
Values:
-
enumerator BORROWED¶
-
enumerator BORROWED_NONNIL¶
-
enumerator BORROWED_NILABLE¶
-
enumerator UNMANAGED¶
-
enumerator UNMANAGED_NONNIL¶
-
enumerator UNMANAGED_NILABLE¶
-
enumerator MANAGED¶
-
enumerator MANAGED_NONNIL¶
-
enumerator MANAGED_NILABLE¶
-
enumerator GENERIC¶
-
enumerator GENERIC_NONNIL¶
-
enumerator GENERIC_NILABLE¶
-
enumerator BORROWED¶
Public Functions
-
inline explicit ClassTypeDecorator(ClassTypeDecoratorEnum val)¶
-
~ClassTypeDecorator() = default¶
-
inline ClassTypeDecoratorEnum val() const¶
Returns the ClassTypeDecoratorEnum value
-
inline ClassTypeDecorator removeNilable() const¶
Returns a decorator based on this one but with unknown nilability
-
inline ClassTypeDecorator addNonNil() const¶
Returns a decorator based on this one but that is non-nilable
-
inline ClassTypeDecorator addNilable() const¶
Returns a decorator based on this one but that is nilable
-
inline ClassTypeDecorator toBorrowed() const¶
Returns a decorator based on this one but with borrowed management (preserving nilability)
-
inline bool isUnknownNilability() const¶
Returns true if this decorator has unknown nilability
-
inline bool isNonNilable() const¶
Returns true if this decorator is non-nilable
-
inline bool isNilable() const¶
Returns true if this decorator is nilable
-
inline bool isBorrowed() const¶
Returns true if this decorator represents a borrowed type (e.g. borrowed C)
-
inline bool isUnmanaged() const¶
Returns true if this decorator represents a unmanaged type (e.g. unmanaged C)
-
inline bool isManaged() const¶
Returns true if this decorator represents a managed type (e.g. owned or shared)
-
inline bool isUnknownManagement() const¶
Returns true if this decorator has unknown management
-
inline ClassTypeDecorator combine(ClassTypeDecorator actual) const¶
Combines decorators assuming that
this
is a formal and the passed decorator is an actual
-
inline bool operator==(ClassTypeDecorator other) const¶
-
inline bool operator!=(ClassTypeDecorator other) const¶
-
inline size_t hash() const¶
-
inline void swap(ClassTypeDecorator other)¶
Public Static Functions
-
static inline ClassTypeDecoratorEnum getIthDecorator(int i)¶
Given an integer i with 0 <= i < NUM_DECORATORS returns a decorator with that number. This can be used to iterate over the possible decorators.
-
static inline ClassTypeDecoratorEnum removeNilableFromDecorator(ClassTypeDecoratorEnum d)¶
-
static inline ClassTypeDecoratorEnum addNonNilToDecorator(ClassTypeDecoratorEnum d)¶
-
static inline ClassTypeDecoratorEnum addNilableToDecorator(ClassTypeDecoratorEnum d)¶
-
static inline bool isDecoratorUnknownNilability(ClassTypeDecoratorEnum d)¶
-
static inline bool isDecoratorNonNilable(ClassTypeDecoratorEnum d)¶
-
static inline bool isDecoratorNilable(ClassTypeDecoratorEnum d)¶
-
static inline bool isDecoratorBorrowed(ClassTypeDecoratorEnum d)¶
-
static inline bool isDecoratorUnmanaged(ClassTypeDecoratorEnum d)¶
-
static inline bool isDecoratorManaged(ClassTypeDecoratorEnum d)¶
-
static inline bool isDecoratorUnknownManagement(ClassTypeDecoratorEnum d)¶
-
static ClassTypeDecoratorEnum combineDecorators(ClassTypeDecoratorEnum formalDecorator, ClassTypeDecoratorEnum actualDecorator)¶
-
enum ClassTypeDecoratorEnum¶
-
class ComplexType : public chpl::types::PrimitiveType¶
- #include <ComplexType.h>
This class represents a complex type, e.g.
complex
orcomplex(64)
.Public Functions
-
~ComplexType() = default¶
-
inline virtual int bitwidth() const override¶
Returns the bit width selected for numeric types. Returns 8 for the default sized bool.
-
inline virtual bool isDefaultWidth() const override¶
Returns true if this PrimitiveType has the default width.
-
inline virtual const char *c_str() const override¶
Returns a C string for the name of this PrimitiveType.
Public Static Functions
-
static const ComplexType *get(Context *context, int bitwidth)¶
-
~ComplexType() = default¶
-
class CompositeType : public chpl::types::Type¶
- #include <CompositeType.h>
This class represents an aggregate type which is a type that contains other elements as fields. Subclasses include BasicClass, Record, Union, and Tuple types.
This class itself does not represent the field types. Instead, it uses the uAST ID of the class/record/union. For a generic type, it also uses a SubstitutionsMap.
(Storing field types in this class would present significant challenges for computing this type in an immutable way within the query framework).
For a generic-with-default type, the main type (with no substitutions) is generic, and the defaulted version is an instantiation of that.
E.g., for
record R { type t = int; }
,the CompositeType for R with no substitutions is a generic type when the version with the default is needed, it will be computed as a CompositeType for R with the substitution t->int which is instantiated from the above type.
Subclassed by chpl::types::BasicClassType, chpl::types::RecordType, chpl::types::TupleType, chpl::types::UnionType
Public Types
-
using SubstitutionsMap = std::unordered_map<ID, types::QualifiedType>¶
A SubstitutionsMap stores a mapping from uAST ID of a field or formal argument to the QualifiedType for it.
When a generic type or function is instantiated, the SubstitutionsMap describes the types that are used to instantiate it. For example, if we have
record R { type t; }
Then
R(int)
is the RecordType with SubstitutionsMap containing a mapping fromt
toint
.Similarly, if we have
proc f(a, param b) { }
Then
f(1.0, 2)
creates an instantiation off
with the SubstitutionsMap containing a mapping froma
toreal
and a mapping fromb
toint
.
-
using SubstitutionPair = std::pair<ID, QualifiedType>¶
-
using SortedSubstitutions = std::vector<SubstitutionPair>¶
Public Functions
-
virtual ~CompositeType() = 0¶
-
virtual void stringify(std::ostream &ss, chpl::StringifyKind stringKind) const override¶
-
inline const ID &id() const¶
Return the uAST ID associated with this CompositeType
-
inline UniqueString name() const¶
Returns the name of the uAST associated with this CompositeType
-
inline const CompositeType *instantiatedFromCompositeType() const¶
If this type represents an instantiated type, returns the type it was instantiated from.
This function always returns the fully generic type and never a partial instantiation. That is, the result will either be nullptr or result->instantiatedFrom() will be nullptr.
-
inline bool isInstantiationOf(Context *context, const CompositeType *genericType) const¶
Returns true if ‘this’ is an instantiation of genericType
-
inline const SubstitutionsMap &substitutions() const¶
Returns the substitutions map
-
SortedSubstitutions sortedSubstitutions() const¶
Returns the substitutions sorted by key ID
-
inline types::QualifiedType substitution(ID declId) const¶
Returns the substitution for a particular declId, or an empty QualifiedType if no substitution was found.
-
using SubstitutionsMap = std::unordered_map<ID, types::QualifiedType>¶
-
class CStringType : public chpl::types::Type¶
- #include <CStringType.h>
This class represents the string type.
Public Functions
-
~CStringType() = default¶
Public Static Functions
-
static const CStringType *get(Context *context)¶
-
~CStringType() = default¶
-
class EnumType : public chpl::types::Type¶
Public Functions
-
~EnumType() = default¶
-
virtual void stringify(std::ostream &ss, StringifyKind stringKind) const override¶
-
inline const UniqueString &name() const¶
Return the name of the uAST associated with this EnumType
-
~EnumType() = default¶
-
class ErroneousType : public chpl::types::Type¶
- #include <ErroneousType.h>
This class represents an erroneous type - that is, a type used as an error sentinel type. Errors with this type should be ignored.
Public Functions
-
~ErroneousType() = default¶
Public Static Functions
-
static const ErroneousType *get(Context *context)¶
-
~ErroneousType() = default¶
-
class ImagType : public chpl::types::PrimitiveType¶
- #include <ImagType.h>
This class represents a imag type, e.g.
imag
orimag(32)
.Public Functions
-
~ImagType() = default¶
-
inline virtual int bitwidth() const override¶
Returns the bit width selected for numeric types. Returns 8 for the default sized bool.
-
inline virtual bool isDefaultWidth() const override¶
Returns true if this PrimitiveType has the default width.
-
inline virtual const char *c_str() const override¶
Returns a C string for the name of this PrimitiveType.
-
~ImagType() = default¶
-
class IntType : public chpl::types::PrimitiveType¶
- #include <IntType.h>
This class represents an int type, e.g.
int
orint(32)
.Public Functions
-
~IntType() = default¶
-
inline virtual int bitwidth() const override¶
Returns the bit width selected for numeric types. Returns 8 for the default sized bool.
-
inline virtual bool isDefaultWidth() const override¶
Returns true if this PrimitiveType has the default width.
-
inline virtual const char *c_str() const override¶
Returns a C string for the name of this PrimitiveType.
-
~IntType() = default¶
-
class NilType : public chpl::types::Type¶
- #include <NilType.h>
This class represents the type of
nil
.Public Functions
-
~NilType() = default¶
-
~NilType() = default¶
-
class NothingType : public chpl::types::Type¶
- #include <NothingType.h>
This class represents the nothing type.
Public Functions
-
~NothingType() = default¶
Public Static Functions
-
static const NothingType *get(Context *context)¶
-
~NothingType() = default¶
-
class Param¶
- #include <Param.h>
This is the base class for classes that represent a param value.
Functions like someParam->isUint32Param() / someParam->toUint32Param() are available and generated for all Param subclasses.
Public Functions
-
virtual ~Param() = 0¶
-
void stringify(std::ostream &ss, chpl::StringifyKind stringKind) const¶
Public Static Functions
-
static QualifiedType fold(Context *context, chpl::uast::PrimitiveTag op, QualifiedType a, QualifiedType b)¶
-
static uint64_t binStr2uint64(const char *str, size_t len, std::string &err)¶
-
static uint64_t octStr2uint64(const char *str, size_t len, std::string &err)¶
-
static uint64_t decStr2uint64(const char *str, size_t len, std::string &err)¶
-
static int64_t decStr2int64(const char *str, size_t len, std::string &err)¶
-
static uint64_t hexStr2uint64(const char *str, size_t len, std::string &err)¶
-
static double str2double(const char *str, size_t len, std::string &err)¶
-
struct ComplexDouble¶
Public Functions
-
inline ComplexDouble(double re, double im)¶
-
inline bool operator==(const ComplexDouble &other) const¶
-
inline bool operator!=(const ComplexDouble &other) const¶
-
inline size_t hash() const¶
-
inline ComplexDouble(double re, double im)¶
-
struct NoneValue¶
-
virtual ~Param() = 0¶
-
class PrimitiveType : public chpl::types::Type¶
- #include <PrimitiveType.h>
This class represents a primitive numeric type (e.g.
bool
,real(32)
) that can have a width.Subclassed by chpl::types::BoolType, chpl::types::ComplexType, chpl::types::ImagType, chpl::types::IntType, chpl::types::RealType, chpl::types::UintType
Public Functions
-
~PrimitiveType() = default¶
-
virtual int bitwidth() const = 0¶
Returns the bit width selected for numeric types. Returns 8 for the default sized bool.
-
virtual bool isDefaultWidth() const = 0¶
Returns true if this PrimitiveType has the default width.
-
virtual const char *c_str() const = 0¶
Returns a C string for the name of this PrimitiveType.
-
virtual void stringify(std::ostream &ss, chpl::StringifyKind stringKind) const override¶
Compute a string representing this type.
Public Static Functions
-
static const PrimitiveType *getWithNameAndWidth(Context *context, UniqueString name, int bitwidth)¶
Get the PrimitiveType according to name and bitwidth, or nullptr if the name or bitwidth are invalid.
-
~PrimitiveType() = default¶
-
class QualifiedType¶
- #include <QualifiedType.h>
This class represents a combination of 3 things: a Type subclass pointer representing a Chapel type a Kind representing variable kind or intent (e.g. ref, value, const) a param value for when the Kind is PARAM.
This combination is the type information that the resolver needs.
Public Types
-
using Kind = uast::IntentList¶
Public Functions
-
inline QualifiedType()¶
-
inline Kind kind() const¶
Returns the kind of the expression this QualifiedType represents
-
inline const Type *type() const¶
Returns the Type subclass that represents the type part of this QualifiedType
-
inline const Param *param() const¶
Returns the param value for this QualifiedType. Note that an uninstantiated param formal will have kind() == PARAM but won’t yet have a param value.
-
inline bool hasTypePtr() const¶
-
inline bool hasParamPtr() const¶
-
inline Type::Genericity typeGenericity() const¶
Returns the fast-to-compute genericity of the contained Type pointer. Does not include consideration of fields. If the type can have fields and they have not been considered, returns Type::MAYBE_GENERIC.
To consider fields, use the getTypeGenericity.
-
inline Type::Genericity genericity() const¶
Returns the fast-to-compute genericity of this QualifiedType. Does not include consideration of fields. If the type can have fields and they have not been considered, returns Type::MAYBE_GENERIC.
To consider fields, use the getTypeGenericity.
-
inline bool isUnknown() const¶
-
inline bool isUnknownKindOrType() const¶
-
inline bool isErroneousType() const¶
-
inline bool isGenericOrUnknown() const¶
-
inline bool isType() const¶
Returns true if kind is TYPE
-
inline bool isParam() const¶
Returns true if kind is PARAM
-
bool isParamTrue() const¶
Returns ‘true’ if storing a BoolParam ‘true’; ‘false’ otherwise
-
bool isParamFalse() const¶
Returns ‘true’ if storing a BoolParam ‘false’; ‘false’ otherwise
-
bool isParamKnownTuple() const¶
Returns ‘true’ if storing a tuple type whose constituent types are all known params.
-
inline bool isConst() const¶
Returns true if the value cannot be modified directly (but might be modified by some other aliasing variable). In particular, returns true for all kinds other than REF and VALUE.
-
inline bool isImmutable() const¶
Returns true if the type refers to something immutable (that cannot be modified by any task / other reference to it).
-
inline bool operator==(const QualifiedType &other) const¶
-
inline bool operator!=(const QualifiedType &other) const¶
-
inline void swap(QualifiedType &other)¶
-
inline size_t hash() const¶
-
void stringify(std::ostream &ss, chpl::StringifyKind stringKind) const¶
Public Static Functions
-
static bool update(QualifiedType &keep, QualifiedType &addin)¶
Public Static Attributes
-
static const Kind UNKNOWN = uast::IntentList::UNKNOWN¶
-
static const Kind DEFAULT_INTENT = uast::IntentList::DEFAULT_INTENT¶
-
static const Kind CONST_INTENT = uast::IntentList::CONST_INTENT¶
-
static const Kind VAR = uast::IntentList::VAR¶
-
static const Kind CONST_VAR = uast::IntentList::CONST_VAR¶
-
static const Kind CONST_REF = uast::IntentList::CONST_REF¶
-
static const Kind REF = uast::IntentList::REF¶
-
static const Kind IN = uast::IntentList::IN¶
-
static const Kind CONST_IN = uast::IntentList::CONST_IN¶
-
static const Kind OUT = uast::IntentList::OUT¶
-
static const Kind INOUT = uast::IntentList::INOUT¶
-
static const Kind PARAM = uast::IntentList::PARAM¶
-
static const Kind TYPE = uast::IntentList::TYPE¶
-
static const Kind TYPE_QUERY = uast::IntentList::TYPE_QUERY¶
-
static const Kind INDEX = uast::IntentList::INDEX¶
-
static const Kind FUNCTION = uast::IntentList::FUNCTION¶
-
static const Kind PARENLESS_FUNCTION = uast::IntentList::PARENLESS_FUNCTION¶
-
static const Kind MODULE = uast::IntentList::MODULE¶
-
using Kind = uast::IntentList¶
-
class RealType : public chpl::types::PrimitiveType¶
- #include <RealType.h>
This class represents a real type, e.g.
real
orreal(32)
.Public Functions
-
~RealType() = default¶
-
inline virtual int bitwidth() const override¶
Returns the bit width selected for numeric types. Returns 8 for the default sized bool.
-
inline virtual bool isDefaultWidth() const override¶
Returns true if this PrimitiveType has the default width.
-
inline virtual const char *c_str() const override¶
Returns a C string for the name of this PrimitiveType.
-
~RealType() = default¶
-
class RecordType : public chpl::types::CompositeType¶
- #include <RecordType.h>
This class represents a record type, e.g., if we have
record R
, thenR
refers to a RecordType.Public Functions
-
~RecordType() = default¶
-
inline const RecordType *instantiatedFrom() const¶
If this type represents an instantiated type, returns the type it was instantiated from.
This is just instantiatedFromCompositeType() with the result cast to RecordType.
Public Static Functions
-
static const RecordType *get(Context *context, ID id, UniqueString name, const RecordType *instantiatedFrom, CompositeType::SubstitutionsMap subs)¶
Get a record type for an ID, possibly instantiated with substitutions
-
static const RecordType *getRangeType(Context *context)¶
Get the range type
-
static const RecordType *getStringType(Context *context)¶
Get the string type
-
static const RecordType *getBytesType(Context *context)¶
Get the bytes type
-
~RecordType() = default¶
-
class TupleType : public chpl::types::CompositeType¶
- #include <TupleType.h>
This class represents a tuple type e.g.
(int, real)
.Public Functions
-
~TupleType() = default¶
-
virtual void stringify(std::ostream &ss, chpl::StringifyKind stringKind) const override¶
-
inline int numElements() const¶
Returns the number of tuple elements. Returns ‘-1’ if the size is not known.
-
QualifiedType elementType(int i) const¶
Return the type of the i’th element
-
inline bool isStarTuple() const¶
Return true if this is a star tuple - that is, all of the element types are the same.
-
inline bool isParamKnown() const¶
Return true if this tuple’s elements are all non-generic params, e.g., (param b: bool = true, param i: int = 0).
-
inline bool isVarArgTuple() const¶
-
inline bool isKnownSize() const¶
-
QualifiedType starType() const¶
Public Static Functions
-
static const TupleType *getValueTuple(Context *context, std::vector<const Type*> eltTypes)¶
Return a value tuple type based on the vector of actual types.
-
static const TupleType *getReferentialTuple(Context *context, std::vector<const Type*> eltTypes)¶
Return a referential tuple type based on the vector of actual types.
-
static const TupleType *getVarArgTuple(Context *context, std::vector<QualifiedType> eltTypes)¶
-
static const TupleType *getVarArgTuple(Context *context, QualifiedType paramSize, QualifiedType starEltType)¶
-
~TupleType() = default¶
-
class Type¶
- #include <Type.h>
This is the base class for classes that represent a type.
Functions like someType->isRecord() / someType->toRecord() are available and generated for all Type subclasses.
Subclassed by chpl::types::AnyType, chpl::types::BuiltinType, chpl::types::CStringType, chpl::types::ClassType, chpl::types::CompositeType, chpl::types::EnumType, chpl::types::ErroneousType, chpl::types::NilType, chpl::types::NothingType, chpl::types::PrimitiveType, chpl::types::UnknownType, chpl::types::VoidType
Public Types
-
enum Genericity¶
Values:
-
enumerator CONCRETE¶
A concrete type e.g. ‘int’
-
enumerator GENERIC¶
A generic type, e.g. ‘integral’
-
enumerator GENERIC_WITH_DEFAULTS¶
A type that is generic but has a default for each generic field. E.g. ‘record R { type t = int; }’.
-
enumerator MAYBE_GENERIC¶
When we need more information to decide if the type is generic. It might depend on fields, e.g.
-
enumerator CONCRETE¶
Public Functions
-
virtual Genericity genericity() const = 0¶
This function returns an enum Genericity value to indicate if the type is concrete, generic, generic with defaults, or maybe generic (e.g. depending on the fields).
This function needs to be defined by subclasses.
-
virtual ~Type() = 0¶
-
virtual void stringify(std::ostream &ss, chpl::StringifyKind stringKind) const¶
-
bool isStringType() const¶
returns true if this represents the string type
-
bool isBytesType() const¶
returns true if this represents the bytes type
-
inline bool isStringLikeType() const¶
returns true if it’s string, bytes, or c_string type
-
inline bool isIntegralType() const¶
returns true if it’s an int or uint type of any width
-
inline bool isNumericType() const¶
returns true if it’s a numeric type of any width; that includes int, uint, real, imag, complex
-
inline bool isNumericOrBoolType() const¶
returns true if it’s a numeric type or bool type of any width
-
inline bool isPtrType() const¶
returns true for a type that is a kind of pointer
-
bool isNilablePtrType() const¶
returns true for a pointer type that can store nil
-
bool isUserRecordType() const¶
Returns true for a type that is a user-defined record. The compiler treats some internal types as records but the language design does not insist that they are.
-
const CompositeType *getCompositeType() const¶
If ‘this’ is a CompositeType, return it. If ‘this’ is a ClassType, return the basicClassType. Otherwise, returns nullptr.
-
enum Genericity¶
-
class UintType : public chpl::types::PrimitiveType¶
- #include <UintType.h>
This class represents a uint type, e.g.
uint
oruint(32)
.Public Functions
-
~UintType() = default¶
-
inline virtual int bitwidth() const override¶
Returns the bit width selected for numeric types. Returns 8 for the default sized bool.
-
inline virtual bool isDefaultWidth() const override¶
Returns true if this PrimitiveType has the default width.
-
inline virtual const char *c_str() const override¶
Returns a C string for the name of this PrimitiveType.
-
~UintType() = default¶
-
class UnionType : public chpl::types::CompositeType¶
- #include <UnionType.h>
This class represents a union type, e.g., if we have
union U
, thenU
refers to a UnionType.Public Functions
-
~UnionType() = default¶
-
inline const UnionType *instantiatedFrom() const¶
If this type represents an instantiated type, returns the type it was instantiated from.
This is just instantiatedFromCompositeType() with the result cast to UnionType.
Public Static Functions
-
static const UnionType *get(Context *context, ID id, UniqueString name, const UnionType *instantiatedFrom, CompositeType::SubstitutionsMap subs)¶
-
~UnionType() = default¶
-
class UnknownType : public chpl::types::Type¶
- #include <UnknownType.h>
This class represents an unknown type when the type is not known because it is not yet established.
Public Functions
-
~UnknownType() = default¶
Public Static Functions
-
static const UnknownType *get(Context *context)¶
-
~UnknownType() = default¶
-
class VoidType : public chpl::types::Type¶
- #include <VoidType.h>
This class represents the void type.
Public Functions
-
~VoidType() = default¶
-
~VoidType() = default¶
-
namespace paramtags¶
-
size_t hashSubstitutionsMap(const CompositeType::SubstitutionsMap &subs)¶