Method: Dhall::TypeChecker::Enum#annotate

Defined in:
lib/dhall/typecheck.rb

#annotate(context) ⇒ Object



692
693
694
695
696
697
698
699
700
701
# File 'lib/dhall/typecheck.rb', line 692

def annotate(context)
  type = Dhall::UnionType.new(
    alternatives: { @enum.tag => nil }
  ).merge(@enum.alternatives)

  # Annotate to sanity check
  TypeChecker.for(type).annotate(context)

  Dhall::TypeAnnotation.new(value: @enum, type: type)
end