AnyType
public struct AnyType : Sendable
extension AnyType: Monotonic
extension AnyType: TypeProtocol
extension AnyType: Equatable
extension AnyType: Hashable
extension AnyType: CustomStringConvertible
The (static) type of an entity.
-
Hylo’s
Anytype.Declaration
Swift
public static let any: AnyType -
Hylo’s
Nevertype.Declaration
Swift
public static let never: AnyType -
Hylo’s
Voidtype.Declaration
Swift
public static let void: AnyType -
A shorthand for
^ErrorType().Declaration
Swift
public static let error: AnyType -
Returns the given built-in type symbol wrapped in a type-erased container.
Declaration
Swift
public static func builtin(_ type: BuiltinType) -> AnyType -
The value wrapped by this instance.
Declaration
Swift
private var wrapped: TypeBox -
Creates a type-erased container wrapping the given instance.
Declaration
Swift
public init<T>(_ base: T) where T : TypeProtocolParameters
baseA type to wrap.
-
Accesses value wrapped by this instance.
The
baseproperty can be cast back to its original type using one of the type casting operators (as?,as!, oras).Declaration
Swift
public var base: any TypeProtocol { get } -
selfif!self[.hasError]; otherwise,nil.Declaration
Swift
public var errorFree: AnyType? { get } -
selftransformed as the type of a member ofreceiver, which is existential.Declaration
Swift
public func asMember(of receiver: ExistentialType) -> AnyType -
Returns the generic arguments specializing
self.Declaration
Swift
public var specialization: GenericArguments { get } -
Indicates whether
selfis a leaf type.A leaf type is a type whose only subtypes are itself and
Never.Declaration
Swift
public var isLeaf: Bool { get } -
Indicates whether
selfis the error type.Declaration
Swift
public var isError: Bool { get } -
Indicates whether
selfis a built-in type.Requires
selfis canonical.Declaration
Swift
public var isBuiltin: Bool { get } -
Indicates whether
selfis a built-in integer type.Requires
selfis canonical.Declaration
Swift
public var isBuiltinInteger: Bool { get } -
trueiffselfis a built-in type or tuple thereof.Requires
selfis canonical.Declaration
Swift
public var isBuiltinOrRawTuple: Bool { get } -
trueiffselfis syntactically equal to Hylo’sVoidorNevertype.Declaration
Swift
public var isVoidOrNever: Bool { get } -
trueiffselfis syntactically equal to Hylo’sVoidtype.Declaration
Swift
public var isVoid: Bool { get } -
trueiffselfis syntactically equal to Hylo’sNevertype.Declaration
Swift
public var isNever: Bool { get } -
Indicates whether
selfis a generic type parameter or associated type.Declaration
Swift
public var isTypeParameter: Bool { get } -
Returns
trueiffselfis bound to an existential quantifier.Declaration
Swift
public var isSkolem: Bool { get } -
Indicates whether
selfhas a record layout.Declaration
Swift
public var hasRecordLayout: Bool { get } -
Returns
selfwith occurrences of free type variables replaced by errors.Declaration
Swift
public var replacingVariablesWithErrors: AnyType { get } -
Inserts the type variables that occur free in
selfintos.Declaration
Swift
public func collectOpenVariables(in s: inout Set<TypeVariable>) -
Calls
actiononmand each type variable that occurs free inself.Declaration
Swift
public func forEachOpenVariable<T>( mutate m: inout T, with action: (inout T, TypeVariable) -> Void ) -
Returns the generic parameters occurring free in
self.Declaration
Swift
public var skolems: OrderedSet<GenericParameterDecl.ID> { get } -
Inserts generic parameters occurring free in
selfintoopen, unless they’re inbound.Declaration
Swift
private func collectGenericTypeParameters( in open: inout OrderedSet<GenericParameterDecl.ID>, ignoring bound: Set<GenericParameterDecl.ID> ) -
Declaration
Swift
public var flags: ValueFlags { get } -
Declaration
Swift
public func transformParts<M>( mutating m: inout M, _ transformer: (inout M, AnyType) -> TypeTransformAction ) -> AnyType -
Returns whether
lis syntactically equal tor.Declaration
Swift
public static func == (l: `Self`, r: `Self`) -> Bool -
Returns whether
lis syntactically equal tor.Declaration
Swift
public static func == <T>(l: `Self`, r: T) -> Bool where T : TypeProtocol -
Returns whether
lis not syntactically equal tor.Declaration
Swift
public static func != <T>(l: `Self`, r: T) -> Bool where T : TypeProtocol -
Returns whether
lis syntactically equal tor.Declaration
Swift
public static func == <T>(l: T, r: `Self`) -> Bool where T : TypeProtocol -
Returns whether
lis not syntactically equal tor.Declaration
Swift
public static func != <T>(l: T, r: `Self`) -> Bool where T : TypeProtocol -
Returns whether
subjectsyntactically matchespattern.This operator is used in switch statements to match the wrapped value of an
AnyType.func foo(_ x: AnyType) { switch x.base { case AnyType.any: print("type is 'Any'") case AnyType.never: print("type is 'Never'") default: print("type is neither 'Any' nor 'Never'") } }Declaration
Swift
public static func ~= (pattern: `Self`, subject: any TypeProtocol) -> Bool -
Returns whether
subjectsyntactically matchespattern.Declaration
Swift
public static func ~= (pattern: `Self`, subject: `Self`) -> Bool -
Returns whether
subjectsyntactically matchespattern.Declaration
Swift
public static func ~= <T>(pattern: T, subject: `Self`) -> Bool where T : TypeProtocol -
Declaration
Swift
public func hash(into hasher: inout Hasher) -
Declaration
Swift
public var description: String { get }
View on GitHub