Class: Dhall::TypeChecker::OperatorRecursiveRecordMerge
- Inherits:
-
Object
- Object
- Dhall::TypeChecker::OperatorRecursiveRecordMerge
- Defined in:
- lib/dhall/typecheck.rb
Instance Method Summary collapse
- #annotate(context) ⇒ Object
-
#initialize(expr) ⇒ OperatorRecursiveRecordMerge
constructor
A new instance of OperatorRecursiveRecordMerge.
Constructor Details
#initialize(expr) ⇒ OperatorRecursiveRecordMerge
Returns a new instance of OperatorRecursiveRecordMerge.
302 303 304 305 306 |
# File 'lib/dhall/typecheck.rb', line 302 def initialize(expr) @expr = expr @lhs = TypeChecker.for(expr.lhs) @rhs = TypeChecker.for(expr.rhs) end |
Instance Method Details
#annotate(context) ⇒ Object
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 |
# File 'lib/dhall/typecheck.rb', line 308 def annotate(context) annotated_lhs = @lhs.annotate(context) annotated_rhs = @rhs.annotate(context) type = annotated_lhs.type.deep_merge_type(annotated_rhs.type) TypeChecker.assert type, Dhall::RecordType, "RecursiveRecordMerge got #{type}" # Annotate to sanity check TypeChecker.for(type).annotate(context) Dhall::TypeAnnotation.new( value: @expr.with(lhs: annotated_lhs, rhs: annotated_rhs), type: type ) end |