89a9f12195a9b84eb1af9423e7fe570b4e7bb940 — Stephen Paul Weber 3 months ago 95511b2
Remove union literal syntax
2 files changed, 4 insertions(+), 39 deletions(-)

M dhall-lang
M lib/dhall/parser.rb
M dhall-lang => dhall-lang +1 -1
@@ 1,1 1,1 @@
-Subproject commit 6cbf57c946e7e6576babc23a38320e53ecfa6bee
+Subproject commit f692f70bafa0322da5d9c4b535b2d323a9c5ac61

M lib/dhall/parser.rb => lib/dhall/parser.rb +3 -38
@@ 384,7 384,7 @@
 				key = [
 					:complete_expression,
 					:record_type_or_literal,
-					:union_type_or_literal
+					:union_type
 				].find { |k| captures.key?(k) }
 				key ? capture(key).value : super
 			end


@@ 396,31 396,6 @@
 			end
 		end
 
-		module UnionTypeOrLiteralVariantType
-			def value(label)
-				rest = capture(:non_empty_union_type_or_literal)&.value
-				type = UnionType.new(
-					alternatives: { label => capture(:expression)&.value }
-				)
-				if rest.is_a?(Union)
-					rest.with(alternatives: type.merge(rest.alternatives))
-				else
-					rest ? type.merge(rest) : type
-				end
-			end
-		end
-
-		module UnionLiteralVariantValue
-			def value(label)
-				Union.new(
-					tag:          label,
-					value:        capture(:expression).value,
-					alternatives: captures(:union_type_entry).map(&:value)
-					              .reduce(UnionType.new(alternatives: {}), &:merge)
-				)
-			end
-		end
-
 		module UnionTypeEntry
 			def value
 				UnionType.new(


@@ 431,19 406,9 @@
 			end
 		end
 
-		module NonEmptyUnionTypeOrLiteral
+		module NonEmptyUnionType
 			def value
-				key = [
-					:union_literal_variant_value,
-					:union_type_or_literal_variant_type
-				].find { |k| captures.key?(k) }
-
-				if key
-					capture(key).value(capture(:any_label).value)
-				else
-					no_alts = UnionType.new(alternatives: {})
-					Union.from(no_alts, capture(:any_label).value, nil)
-				end
+				captures(:union_type_entry).map(&:value).reduce(&:merge)
 			end
 		end