~singpolyma/dhall-ruby

b393cbaa4847ec4f63a928593f79a22b7337a838 — Stephen Paul Weber 3 years ago 6acdd5f
Normalize text concat as interpolation
2 files changed, 1 insertions(+), 12 deletions(-)

M lib/dhall/ast.rb
M lib/dhall/normalize.rb
M lib/dhall/ast.rb => lib/dhall/ast.rb +0 -4
@@ 41,10 41,6 @@ module Dhall
			end
		end

		def <<(other)
			Operator::TextConcatenate.new(lhs: self, rhs: other)
		end

		def concat(other)
			Operator::ListConcatenate.new(lhs: self, rhs: other)
		end

M lib/dhall/normalize.rb => lib/dhall/normalize.rb +1 -8
@@ 199,14 199,7 @@ module Dhall

		class TextConcatenate
			def normalize
				normalized = super
				if normalized.lhs == Text.new(value: "")
					normalized.rhs
				elsif normalized.rhs == Text.new(value: "")
					normalized.lhs
				else
					normalized.lhs << normalized.rhs
				end
				TextLiteral.for(lhs, rhs).normalize
			end
		end