~singpolyma/dhall-ruby

1d780e3ddde3be4258a6eddba2ab9e131cd789e1 — Stephen Paul Weber 3 years ago d5231cf
Fix for substitute on LetBlock/LetIn
1 files changed, 15 insertions(+), 0 deletions(-)

M lib/dhall/normalize.rb
M lib/dhall/normalize.rb => lib/dhall/normalize.rb +15 -0
@@ 386,6 386,17 @@ module Dhall
				body: body.shift(amount, name, min_index + 1)
			)
		end

		def substitute(svar, with_expr)
			var = let.var
			with(
				let:  let.substitute(svar, with_expr),
				body: body.substitute(
					var == svar.name ? svar.with(index: svar.index + 1) : svar,
					with_expr.shift(1, var, 0)
				)
			)
		end
	end

	class LetBlock


@@ 396,6 407,10 @@ module Dhall
		def shift(amount, name, min_index)
			unflatten.shift(amount, name, min_index)
		end

		def substitute(svar, with_expr)
			unflatten.substitute(svar, with_expr)
		end
	end

	class TypeAnnotation