CType is a "compiler type" which is class used for representing the Fantom type system in the compiler. CTypes map to types within the compilation units themsevles as TypeDef and TypeRef or to precompiled types in imported pods via ReflectType or FType.
abstract CType? base()
The direct super class of this type (null for Obj).
If this is a foreign function return the bridge.
Given a list of types, compute the most specific type which they all share, or at worst return sys::Obj. This method does not take into account mixins, only extends class inheritance.
List of the all constructors.
virtual CType deref()
If this is a TypeRef, return what it references
Equality based on signature.
Get the facet keyed by given type, or null if not defined.
Lookup a field by name (null if method).
List of the all defined fields (including inherited fields).
Does this type implement the specified type. If true, then this type is assignable to the specified type (although the converse is not necessarily true). All types (including mixin types) fit sys::Obj.
Return if this type fits any of the types in the specified list.
abstract Int flags()
Get the flags bitmask.
If this TypeDef extends from a FFI class or implements any FFI mixins, then return the FFI type otherwise return null.
Return if the given facet is defined.
Return if this type contains a slot by the specified name.
virtual override Int hash()
Hash on signature.
virtual CType inferredAs()
If this type is being used for type inference then get the type as it should be inferred. Typically we just return this. However some FFI types such as
[java]::intare never used on the stack directly and are inferred to be
List of the all instance constructors.
Return if this Type is abstract and cannot be instantiated. This method will always return true if the type is a mixin.
Return if this Type is a class (as opposed to enum or mixin)
Return if this Type is const and immutable.
Is this type ok to use as a const field? Any const type fine, plus we allow Obj, List, Map, and Func since they will implicitly have toImmutable called on them.
Return if this Type is an sys::Enum
Return if this Type is an sys::Facet
Return if this Type is final and cannot be subclassed.
virtual Bool isForeign()
If this a foreign function interface type.
abstract Bool isGeneric()
A generic type means that one or more of my slots contain signatures using a generic parameter (such as V or K). Fantom supports three built-in generic types: List, Map, and Func. A generic instance (such as Str) is NOT a generic type (all of its generic parameters have been filled in). User defined generic types are not supported in Fan.
abstract Bool isGenericParameter()
Return if this type is a generic parameter (such as V or K) in a generic type (List, Map, or Method). Generic parameters serve as place holders for the parameterization of the generic type. Fantom has a predefined set of generic parameters which are always defined in the sys pod with a one character name.
Is this an internally scoped class
Return if this Type is a mixin type and cannot be instantiated.
Is the entire class implemented in native code?
abstract Bool isNullable()
Is this is a nullable type (marked with trailing ?)
abstract Bool isParameterized()
A parameterized type is a type which has parameterized a generic type and replaced all the generic parameter types with generic argument types. The type Str is a parameterized type of the generic type List (V is replaced with Str). A parameterized type always has a signature which is different from the qname.
Is this a public scoped class
virtual Bool isSupported()
Return if type is supported by the Fantom type system. For example the Java FFI will correctly model a Java multi-dimensional array during compilation, however there is no Fantom representation. We check for supported types during CheckErrors when accessing fields and methods.
Is this a compiler generated synthetic class
abstract Bool isVal()
Is this is a value type (Bool, Int, or Float and their nullables)
Static utility for value type
virtual Bool isValid()
Is this a valid type usable anywhere (such as local var)
Lookup a method by name (null if field).
List of the all defined methods (including inherited methods).
abstract CType mixins()
Return the mixins directly implemented by this type.
abstract Str name()
Simple name of the type such as "Str".
abstract CNamespace ns()
Associated namespace for this type representation
abstract COperators operators()
Get operators lookup structure
If this is a parameterized type which uses
This, then replace
Thiswith the specified type.
abstract CPod pod()
Parent pod which defines this type.
abstract Str qname()
Qualified name such as "sys:Str".
If this type is a generic parameter (V, L, etc), then return the actual type for the native implementation. For example V is Obj, and L is List. This is the type we actually use when constructing a signature for the invoke opcode.
abstract Str signature()
This is the full signature of the type.
Lookup a slot by name. If the slot doesn't exist then return null.
Map of the all defined slots, both fields and methods (including inherited slots).
abstract CType toListOf()
Create a parameterized List of this type.
virtual CType toNonNullable()
Get this type as a non-nullable (if nullable)
abstract CType toNullable()
Get this type as a nullable type (marked with trailing ?)
override Str toStr()