Class: Dhall::TypeChecker::Optional
- Inherits:
-
Object
- Object
- Dhall::TypeChecker::Optional
- Defined in:
- lib/dhall/typecheck.rb
Instance Method Summary collapse
- #annotate(context) ⇒ Object
-
#initialize(some) ⇒ Optional
constructor
A new instance of Optional.
Constructor Details
#initialize(some) ⇒ Optional
Returns a new instance of Optional.
446 447 448 |
# File 'lib/dhall/typecheck.rb', line 446 def initialize(some) @some = some end |
Instance Method Details
#annotate(context) ⇒ Object
450 451 452 453 454 455 456 457 458 459 460 461 |
# File 'lib/dhall/typecheck.rb', line 450 def annotate(context) asome = @some.map do |el| TypeChecker.for(el).annotate(context) end some = asome.with(value_type: asome.value.type) type_type = TypeChecker.for(some.value_type).annotate(context).type TypeChecker.assert type_type, Builtins[:Type], "Some type not of type Type, was: #{type_type}" Dhall::TypeAnnotation.new(type: some.type, value: some) end |