Skip to content

class Crystal::TypeSplat
inherits Crystal::Type

A splatted type inside an inherited generic class or included generic module.

For example, given:

class Foo(T)
  include Bar(Union(*T))
end

the T in the included type will be a TypeParameter, but we can't splat it yet (expands the types behind T) until we know T. We mark this as a TypeSplat of the type parameter T.

When instantiating Foo, T will be replaced with the instantiated type and this TypeSplat will check that it's a tuple type and append its types to the final type variables.

Class methods

.new(program, splatted_type : TypeParameter)

View source

Methods

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

View source