Class: Rigor::Type::Top

Inherits:
Object
  • Object
show all
Defined in:
lib/rigor/type/top.rb

Overview

The top of the value lattice: contains every value, including untyped boundaries. See docs/type-specification/special-types.md.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceObject



11
12
13
# File 'lib/rigor/type/top.rb', line 11

def instance
  @instance ||= new.freeze
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



42
43
44
# File 'lib/rigor/type/top.rb', line 42

def ==(other)
  other.is_a?(Top)
end

#accepts(other, mode: :gradual) ⇒ Object



38
39
40
# File 'lib/rigor/type/top.rb', line 38

def accepts(other, mode: :gradual)
  Inference::Acceptance.accepts(self, other, mode: mode)
end

#botObject



30
31
32
# File 'lib/rigor/type/top.rb', line 30

def bot
  Trinary.no
end

#describe(_verbosity = :short) ⇒ Object



18
19
20
# File 'lib/rigor/type/top.rb', line 18

def describe(_verbosity = :short)
  "top"
end

#dynamicObject



34
35
36
# File 'lib/rigor/type/top.rb', line 34

def dynamic
  Trinary.no
end

#erase_to_rbsObject



22
23
24
# File 'lib/rigor/type/top.rb', line 22

def erase_to_rbs
  "top"
end

#hashObject



47
48
49
# File 'lib/rigor/type/top.rb', line 47

def hash
  Top.hash
end

#inspectObject



51
52
53
# File 'lib/rigor/type/top.rb', line 51

def inspect
  "#<Rigor::Type::Top>"
end

#topObject



26
27
28
# File 'lib/rigor/type/top.rb', line 26

def top
  Trinary.yes
end