class Dhall::TypeChecker::Optional

Public Class Methods

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

Public Instance Methods

annotate(context) click to toggle source
# File lib/dhall/typecheck.rb, line 473
def annotate(context)
        asome = @some.map do |el|
                TypeChecker.for(el).annotate(context)
        end
        some = asome.with(value_type: asome.value.type)

        type_type = TypeChecker.for(some.value_type).annotate(context).type
        TypeChecker.assert type_type, Builtins[:Type],
                           "Some type not of type Type, was: #{type_type}"

        Dhall::TypeAnnotation.new(type: some.type, value: some)
end