abstract class Crystal::UnionType
inherits Crystal::Type
¶
Base class for instantiated union types.
Included modules
Crystal::MultiType
Direct known subclasses
Crystal::MixedUnionType
Crystal::NilableProcType
Crystal::NilableReferenceUnionType
Crystal::NilableType
Crystal::ReferenceUnionType
Class methods¶
Methods¶
#all?
¶
Yields self and returns true if the block returns a truthy value. UnionType overrides it and yields all types in turn and returns true if for each of them the block returns true.
#lookup_path_item(name : String, lookup_in_namespace, include_private, location)
¶
(name : String, lookup_in_namespace, include_private, location)
Looks up a single path item relative to *self`.
If lookup_in_namespace is true
, if the type is not found
in self
or self
's parents, the path item is searched in this
type's namespace. This parameter is useful because when writing
Foo::Bar::Baz
, Foo
should be searched in enclosing namespaces,
but Bar
and Baz
not.
#replace_type_parameters(instance)
¶
(instance)
Replace type parameters in this type with the type parameters of the given instance type.