class Dhall::TypeChecker::OperatorRecursiveRecordTypeMerge

Public Class Methods

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

Public Instance Methods

annotate(context) click to toggle source
# File lib/dhall/typecheck.rb, line 365
def annotate(context)
        type = @expr.lhs.deep_merge_type(@expr.rhs)

        TypeChecker.assert type, Dhall::RecordType,
                           "RecursiveRecordMerge got #{type}"

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

        Dhall::TypeAnnotation.new(value: @expr, type: kind(context))
end
kind(context) click to toggle source
# File lib/dhall/typecheck.rb, line 377
def kind(context)
        lhs_kind = KINDS.index(TypeChecker.for(@expr.lhs).annotate(context).type)
        rhs_kind = KINDS.index(TypeChecker.for(@expr.rhs).annotate(context).type)
        KINDS[[lhs_kind, rhs_kind].max]
end