Skip to content

abstract class Crystal::NamedType
inherits Crystal::Type

A type that has a name and can be inside a namespace. For example, given class Foo::Bar, Foo is the namespace and Bar is the name.

There are other types that have a name but it can be deduced from other(s) type(s), so they don't inherit NamedType: a union type, a metaclass, etc.

Direct known subclasses

Crystal::AliasType Crystal::AnnotationType Crystal::Const Crystal::ModuleType Crystal::NoReturnType Crystal::TypeDefType Crystal::VoidType

Class methods

.new(program, namespace, name)

View source

Methods

#add_location(location : Location)

Adds a location to this type.

View source

#append_full_name(io : IO, codegen : Bool = false) : Nil

View source

#doc : String?

Returns any doc comments associated to this type.

View source

#doc=(doc : String?)

View source

#full_name

View source

#locations : Array(Location)?

Returns all locations where this type is declared

View source

#namespace : ModuleType

The namespace this type belongs to. Every type belongs to a namespace, and, when not explicit, the namespace is the Program itself.

View source

#private=(private __arg0 : Bool)

View source

#private? : Bool

View source

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

View source

#types

View source