module Crystal::GenericType

Overview

A non-instantiated generic type, like Array(T), Hash(K, V) or Enumerable(T).

Included Modules

Direct including types

Defined in:

compiler/crystal/semantic/path_lookup.cr
compiler/crystal/types.cr

Instance Method Summary

Instance methods inherited from module Crystal::InstanceVarContainer

instance_vars instance_vars

Instance Method Detail

def add_inherited(type) #

[View source]
def add_instance_var_initializer(name, value, meta_vars) #

[View source]
def double_variadic=(double_variadic) #

Is it **? Currently only NamedTuple is.


[View source]
def double_variadic? #

Is it **? Currently only NamedTuple is.


[View source]
def each_instantiated_type(&) #

[View source]
def inherited : Array(Type) | Nil #

[View source]
def instantiate(type_vars) #

[View source]
def instantiated_generic_superclass(instance) #

[View source]
def instantiated_types #

Returns an array of all instantiations of this generic type. NamedTupleType overrides this because it doesn't use positional type arguments.


[View source]
def lookup_path_item(name : String, lookup_self, lookup_in_namespace, include_private, location) #

[View source]
def notify_parents_subclass_added(type) #

[View source]
def run_instance_var_initializer(initializer, instance : GenericClassInstanceType | NonGenericClassType) #

[View source]
def run_instance_var_initializer(initializer, instance) #

[View source]
def run_instance_vars_initializers(real_type, type : GenericClassType | ClassType, instance) #

[View source]
def run_instance_vars_initializers(real_type, type, instance) #

[View source]
def splat_index : Int32 | Nil #

The index of the * in the type variables.


[View source]
def splat_index=(splat_index : Int32 | Nil) #

The index of the * in the type variables.


[View source]
def type_parameter(name) : TypeParameter #

Returns a TypeParameter relative to this type


[View source]
def type_var?(name) #

[View source]
def type_vars : Array(String) #

The type variable names (K and V in Hash).


[View source]