class Dhall::TypeChecker::Enum

Public Class Methods

new(enum) click to toggle source
# File lib/dhall/typecheck.rb, line 688
def initialize(enum)
        @enum = enum
end

Public Instance Methods

annotate(context) click to toggle source
# 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