Class: Rigor::Type::Dynamic

Inherits:
Object
  • Object
show all
Includes:
AcceptanceRouter, ValueSemantics
Defined in:
lib/rigor/type/dynamic.rb

Overview

The dynamic-origin wrapper: marks values whose type came from an unchecked source. Carries a static facet that records the analyzer’s best static knowledge. See docs/type-specification/value-lattice.md for the algebra and docs/type-specification/special-types.md for the untyped/Dynamic relationship.

Construct via Rigor::Type::Combinator.dynamic(static_facet).

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ValueSemantics

included

Methods included from AcceptanceRouter

#accepts

Constructor Details

#initialize(static_facet) ⇒ Dynamic

Returns a new instance of Dynamic.



19
20
21
22
# File 'lib/rigor/type/dynamic.rb', line 19

def initialize(static_facet)
  @static_facet = static_facet
  freeze
end

Instance Attribute Details

#static_facetObject (readonly)

Returns the value of attribute static_facet.



17
18
19
# File 'lib/rigor/type/dynamic.rb', line 17

def static_facet
  @static_facet
end

Instance Method Details

#botObject



36
37
38
# File 'lib/rigor/type/dynamic.rb', line 36

def bot
  Trinary.no
end

#describe(verbosity = :short) ⇒ Object



24
25
26
# File 'lib/rigor/type/dynamic.rb', line 24

def describe(verbosity = :short)
  "Dynamic[#{static_facet.describe(verbosity)}]"
end

#dynamicObject



40
41
42
# File 'lib/rigor/type/dynamic.rb', line 40

def dynamic
  Trinary.yes
end

#erase_to_rbsObject



28
29
30
# File 'lib/rigor/type/dynamic.rb', line 28

def erase_to_rbs
  "untyped"
end

#inspectObject



50
51
52
# File 'lib/rigor/type/dynamic.rb', line 50

def inspect
  "#<Rigor::Type::Dynamic #{describe(:short)}>"
end

#topObject



32
33
34
# File 'lib/rigor/type/dynamic.rb', line 32

def top
  Trinary.no
end