Class: Dhall::TypeChecker::OperatorRightBiasedRecordMerge
- Inherits:
-
Object
- Object
- Dhall::TypeChecker::OperatorRightBiasedRecordMerge
- Defined in:
- lib/dhall/typecheck.rb
Instance Method Summary collapse
- #annotate(context) ⇒ Object
- #check(context) ⇒ Object
-
#initialize(expr) ⇒ OperatorRightBiasedRecordMerge
constructor
A new instance of OperatorRightBiasedRecordMerge.
Constructor Details
#initialize(expr) ⇒ OperatorRightBiasedRecordMerge
Returns a new instance of OperatorRightBiasedRecordMerge.
330 331 332 |
# File 'lib/dhall/typecheck.rb', line 330 def initialize(expr) @expr = expr end |
Instance Method Details
#annotate(context) ⇒ Object
346 347 348 349 350 351 352 353 354 355 |
# File 'lib/dhall/typecheck.rb', line 346 def annotate(context) annotated_lhs, annotated_rhs = check(context) Dhall::TypeAnnotation.new( value: @expr.with(lhs: annotated_lhs, rhs: annotated_rhs), type: TypeChecker.for( annotated_lhs.type.merge_type(annotated_rhs.type) ).annotate(context).value ) end |
#check(context) ⇒ Object
334 335 336 337 338 339 340 341 342 343 344 |
# File 'lib/dhall/typecheck.rb', line 334 def check(context) annotated_lhs = TypeChecker.assert_type @expr.lhs, Dhall::RecordType, "RecursiveRecordMerge got", context: context annotated_rhs = TypeChecker.assert_type @expr.rhs, Dhall::RecordType, "RecursiveRecordMerge got", context: context [annotated_lhs, annotated_rhs] end |