Class: Dhall::TypeChecker::AnonymousType
- Inherits:
-
Object
- Object
- Dhall::TypeChecker::AnonymousType
- Defined in:
- lib/dhall/typecheck.rb
Instance Method Summary collapse
- #annotate(context) ⇒ Object
-
#initialize(type) ⇒ AnonymousType
constructor
A new instance of AnonymousType.
Constructor Details
#initialize(type) ⇒ AnonymousType
Returns a new instance of AnonymousType.
473 474 475 |
# File 'lib/dhall/typecheck.rb', line 473 def initialize(type) @type = type end |
Instance Method Details
#annotate(context) ⇒ Object
477 478 479 480 481 482 483 484 485 486 487 488 489 490 |
# File 'lib/dhall/typecheck.rb', line 477 def annotate(context) kinds = @type.record.values.compact.map do |mtype| TypeChecker.for(mtype).annotate(context).type end TypeChecker.assert (kinds - KINDS), [], "AnonymousType field kind not one of #{KINDS}" TypeChecker.assert kinds, Util::ArrayAllTheSame, "AnonymousType field kinds not all the same" type = kinds.first || KINDS.first Dhall::TypeAnnotation.new(value: @type, type: type) end |