class Dhall::TypeChecker::OperatorRightBiasedRecordMerge

Public Class Methods

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

Public Instance Methods

annotate(context) click to toggle source
# File lib/dhall/typecheck.rb, line 346
def annotate(context)
        annotated_lhs, annotated_rhs = check(context)

        Dhall::TypeAnnotation.new(
                value: @expr.with(lhs: annotated_lhs, rhs: annotated_rhs),
                type:  TypeChecker.for(
                        annotated_lhs.type.merge_type(annotated_rhs.type)
                ).annotate(context).value
        )
end
check(context) click to toggle source
# File lib/dhall/typecheck.rb, line 334
def check(context)
        annotated_lhs = TypeChecker.assert_type @expr.lhs, Dhall::RecordType,
                                                "RecursiveRecordMerge got",
                                                context: context

        annotated_rhs = TypeChecker.assert_type @expr.rhs, Dhall::RecordType,
                                                "RecursiveRecordMerge got",
                                                context: context

        [annotated_lhs, annotated_rhs]
end