class Myst::TypeCheck::Type

Direct Known Subclasses

Defined in:

typecheck/type.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String, id : UInt64 = @@next_id, *, static_type : Myst::TypeCheck::Type | Nil = nil, instance_type : Myst::TypeCheck::Type | Nil = nil, super_type : Myst::TypeCheck::Type | Nil = nil) #

[View source]

Instance Method Detail

def ==(other : self) #
Description copied from class Reference

Returns true if this reference is the same as other. Invokes same?.


def ancestors #

[View source]
def exclude(other : Type) #

Excluding a type from a singular type is non-sensical, and should never happen. However, it needs to be supported on all Types for consistency.


[View source]
def hash(hasher) #
Description copied from class Reference

See Object#hash(hasher)


def id : UInt64 #

[View source]
def id=(id : UInt64) #

[View source]
def includes?(other : Type) #

[View source]
def instance_type #

Likewise for instance types.


[View source]
def instance_type=(instance_type : Type | Nil) #

[View source]
def instance_type? : Type | Nil | Nil #

def instantiable? #

A type is considered instantiable if it has an #instance_type. This is the type that would be returned by an instantiation of this type.


[View source]
def name : String #

[View source]
def name=(name : String) #

[View source]
def scope : Scope #

[View source]
def scope=(scope : Scope) #

[View source]
def static_type #

To avoid having to check if a type is static in the visitor, assume that static types won't have the @static_type relationship set, and return self in that case.


[View source]
def static_type=(static_type : Type | Nil) #

[View source]
def static_type? : Type | Nil | Nil #

def super_type : Type | Nil #

def super_type=(super_type : Type | Nil) #

[View source]
def super_type? : Type | Nil | Nil #

def to_s(io : IO) #
Description copied from class Reference

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>

[View source]
def union_with(other : Type) #

[View source]
def union_with(other : UnionType) #

[View source]