Method: Dhall::TypeChecker::Application#annotate

Defined in:
lib/dhall/typecheck.rb

#annotate(context) ⇒ Object



955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
# File 'lib/dhall/typecheck.rb', line 955

def annotate(context)
	afunc = @func.annotate(context)

	TypeChecker.assert afunc.type, Dhall::Forall,
	                   "Application LHS is not a function"

	aarg = TypeChecker.for(
		Dhall::TypeAnnotation.new(value: @arg, type: afunc.type.type)
	).annotate(context)

	Dhall::TypeAnnotation.new(
		value: @app.with(function: afunc, argument: aarg),
		type:  afunc.type.call(aarg.value)
	)
end