class Dhall::TypeChecker::OperatorListConcatenate

Public Class Methods

new(expr) click to toggle source
# File lib/dhall/typecheck.rb, line 270
def initialize(expr)
        @expr = expr
        @lhs = TypeChecker.for(expr.lhs)
        @rhs = TypeChecker.for(expr.rhs)
end

Public Instance Methods

annotate(context) click to toggle source
# File lib/dhall/typecheck.rb, line 283
def annotate(context)
        annotated_lhs = @lhs.annotate(context)
        annotated_rhs = @rhs.annotate(context)

        types = [annotated_lhs.type, annotated_rhs.type]
        assertion = Util::ArrayOf.new(Util::AllOf.new(IsList, types.first))
        TypeChecker.assert types, assertion,
                           "Operator arguments wrong: #{types}"

        Dhall::TypeAnnotation.new(
                value: @expr.with(lhs: annotated_lhs, rhs: annotated_rhs),
                type:  types.first
        )
end