Skip to content

class Crystal::GenericClassType
inherits Crystal::ClassType

A generic class type, like Array(T).

Included modules

Crystal::ClassVarContainer Crystal::GenericType

Direct known subclasses

Crystal::GenericUnionType Crystal::NamedTupleType Crystal::PointerType Crystal::ProcType Crystal::StaticArrayType Crystal::TupleType

Class methods

.new(program, namespace, name, superclass, type_vars : Array(String), add_subclass = true)

View source

Methods

#can_be_stored?

Returns true if this type can be assigned to an instance or class variable, or used in a generic type argument.

As of now, abstract base type such as Object, Reference, Value, Int, and unbound generic types such as Array(T), can't be stored.

View source

#class?

View source

#common_ancestor(other : Type)

View source

#including_types

View source

#new_generic_instance(program, generic_type, type_vars)

View source

#remove_indirection

View source

#restriction_of?(other : GenericClassInstanceType, owner, strict = false)

View source

#to_s_with_options(io : IO, skip_union_parens : Bool = false, generic_args : Bool = true, codegen : Bool = false) : Nil

View source

#type_desc

View source