Class: Rigor::Type::Dynamic
- Inherits:
-
Object
- Object
- Rigor::Type::Dynamic
- 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
-
#static_facet ⇒ Object
readonly
Returns the value of attribute static_facet.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #accepts(other, mode: :gradual) ⇒ Object
- #bot ⇒ Object
- #describe(verbosity = :short) ⇒ Object
- #dynamic ⇒ Object
- #erase_to_rbs ⇒ Object
- #hash ⇒ Object
-
#initialize(static_facet) ⇒ Dynamic
constructor
A new instance of Dynamic.
- #inspect ⇒ Object
- #top ⇒ Object
Constructor Details
#initialize(static_facet) ⇒ Dynamic
Returns a new instance of Dynamic.
17 18 19 20 |
# File 'lib/rigor/type/dynamic.rb', line 17 def initialize(static_facet) @static_facet = static_facet freeze end |
Instance Attribute Details
#static_facet ⇒ Object (readonly)
Returns the value of attribute static_facet.
15 16 17 |
# File 'lib/rigor/type/dynamic.rb', line 15 def static_facet @static_facet end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
46 47 48 |
# File 'lib/rigor/type/dynamic.rb', line 46 def ==(other) other.is_a?(Dynamic) && static_facet == other.static_facet end |
#accepts(other, mode: :gradual) ⇒ Object
42 43 44 |
# File 'lib/rigor/type/dynamic.rb', line 42 def accepts(other, mode: :gradual) Inference::Acceptance.accepts(self, other, mode: mode) end |
#describe(verbosity = :short) ⇒ Object
22 23 24 |
# File 'lib/rigor/type/dynamic.rb', line 22 def describe(verbosity = :short) "Dynamic[#{static_facet.describe(verbosity)}]" end |
#erase_to_rbs ⇒ Object
26 27 28 |
# File 'lib/rigor/type/dynamic.rb', line 26 def erase_to_rbs "untyped" end |
#hash ⇒ Object
51 52 53 |
# File 'lib/rigor/type/dynamic.rb', line 51 def hash [Dynamic, static_facet].hash end |
#inspect ⇒ Object
55 56 57 |
# File 'lib/rigor/type/dynamic.rb', line 55 def inspect "#<Rigor::Type::Dynamic #{describe(:short)}>" end |