Class: Dhall::TypeChecker::EmptyList
- Inherits:
-
Object
- Object
- Dhall::TypeChecker::EmptyList
- Defined in:
- lib/dhall/typecheck.rb
Instance Method Summary collapse
- #annotate(context) ⇒ Object
-
#initialize(expr) ⇒ EmptyList
constructor
A new instance of EmptyList.
Constructor Details
#initialize(expr) ⇒ EmptyList
Returns a new instance of EmptyList.
364 365 366 |
# File 'lib/dhall/typecheck.rb', line 364 def initialize(expr) @expr = expr.with(type: expr.type.normalize) end |
Instance Method Details
#annotate(context) ⇒ Object
368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/dhall/typecheck.rb', line 368 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 |