Class: Typisch::Type::Constructor::Singleton

Inherits:
Typisch::Type::Constructor show all
Defined in:
lib/typisch/constructor.rb

Overview

A class of constructor type of which there is only one type, and hence only one tag.

Will have no supertype besides Any, and no subtype besides Nothing.

(abstract superclass; see Boolean or Null for example subclasses).

Direct Known Subclasses

Type::Null, Boolean, Date, Time

Constant Summary

Constants inherited from Typisch::Type::Constructor

CONSTRUCTOR_TYPE_SUBCLASSES

Instance Attribute Summary

Attributes inherited from Typisch::Type

#name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Typisch::Type::Constructor

#alternative_types, #check_type, inherited, #type_lattice

Methods inherited from Typisch::Type

#<, #<=, #<=>, #==, #===, #>, #>=, #alternative_types, #annotations, #annotations=, #canonicalize!, #excluding_null, #inspect, #recursive?, #shallow_check_type, subtype?, #target, #to_string

Class Method Details

.check_subtype(x, y) ⇒ Object



94
95
96
# File 'lib/typisch/constructor.rb', line 94

def check_subtype(x, y)
  true
end

.tagObject

Raises:

  • (NotImplementedError)


86
87
88
# File 'lib/typisch/constructor.rb', line 86

def tag
  raise NotImplementedError
end

.top_typeObject



90
91
92
# File 'lib/typisch/constructor.rb', line 90

def top_type(*)
  @top_type ||= new
end

Instance Method Details

#subexpression_typesObject



99
100
101
# File 'lib/typisch/constructor.rb', line 99

def subexpression_types
  []
end

#tagObject



103
104
105
# File 'lib/typisch/constructor.rb', line 103

def tag
  self.class.tag
end

#to_sObject



107
108
109
# File 'lib/typisch/constructor.rb', line 107

def to_s(*)
  @name.inspect
end