class Dhall::TypeChecker::EmptyList

Public Class Methods

new(expr) click to toggle source
# File lib/dhall/typecheck.rb, line 387
def initialize(expr)
        @expr = expr.with(type: expr.type.normalize)
end

Public Instance Methods

annotate(context) click to toggle source
# File lib/dhall/typecheck.rb, line 391
def annotate(context)
        TypeChecker.assert @expr.type, Dhall::Application,
                           "EmptyList unknown type #{@expr.type.inspect}"

        TypeChecker.assert @expr.type.function, Builtins[:List],
                           "EmptyList unknown type #{@expr.type.inspect}"

        TypeChecker.assert_type @expr.element_type, Builtins[:Type],
                                "EmptyList element type not of type Type",
                                context: context

        Dhall::TypeAnnotation.new(type: @expr.type, value: @expr)
end