class Dhall::TypeChecker::AnonymousType

Public Class Methods

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

Public Instance Methods

annotate(context) click to toggle source
# File lib/dhall/typecheck.rb, line 509
def annotate(context)
        kinds = check(context)
        type = kinds.max_by { |k| KINDS.index(k) } || KINDS.first
        Dhall::TypeAnnotation.new(value: @type, type: type)
end

Protected Instance Methods

check(context) click to toggle source
# File lib/dhall/typecheck.rb, line 517
def check(context)
        kinds = @type.record.values.compact.map do |mtype|
                TypeChecker.for(mtype).annotate(context).type
        end

        TypeChecker.assert (kinds - KINDS), [],
                           "AnonymousType field kind not one of #{KINDS}"

        kinds
end