Skip to content

Commit

Permalink
Allow empty unions by using whether a type is marked as a union (rath…
Browse files Browse the repository at this point in the history
…er than the existence of members) to decide whether it is concrete.
  • Loading branch information
stuhood committed May 16, 2019
1 parent 2c95f85 commit 60d96c2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/python/pants/engine/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 202,9 @@ def add_get_edge(product, subject):
self._native.lib.tasks_add_get(self._tasks, self._to_type(product), self._to_type(subject))

for the_get in rule.input_gets:
union_members = union_rules.get(the_get.subject_declared_type, None)
if union_members:
if getattr(the_get.subject_declared_type, '_is_union', False):
# If the registered subject type is a union, add Get edges to all registered union members.
for union_member in union_members:
for union_member in union_rules.get(the_get.subject_declared_type, []):
add_get_edge(the_get.product, union_member)
else:
# Otherwise, the Get subject is a "concrete" type, so add a single Get edge.
Expand Down

0 comments on commit 60d96c2

Please sign in to comment.