Class: Dhall::TypeChecker::Variable

Inherits:
Object
  • Object
show all
Defined in:
lib/dhall/typecheck.rb

Instance Method Summary collapse

Constructor Details

#initialize(var) ⇒ Variable

Returns a new instance of Variable.



83
84
85
# File 'lib/dhall/typecheck.rb', line 83

def initialize(var)
  @var = var
end

Instance Method Details

#annotate(context) ⇒ Object

Raises:

  • (TypeError)


87
88
89
90
91
92
93
94
# File 'lib/dhall/typecheck.rb', line 87

def annotate(context)
  raise TypeError, "Sort has no Type, Kind, or Sort" if @var.name == "Sort"

  Dhall::TypeAnnotation.new(
    value: @var,
    type:  context.fetch(@var)
  )
end