Method: Emfrp::Typing::UnionType#unite

Defined in:
lib/emfrp/typing/union_type.rb

#unite(a, b) ⇒ Object



85
86
87
88
89
90
91
# File 'lib/emfrp/typing/union_type.rb', line 85

def unite(a, b)
  new_union = (a.collect_union + b.collect_union).uniq
  substitute_id = new_union.map{|t| t.name_id}.min
  new_union.each{|t| t.name_id = substitute_id}
  a.union = new_union
  b.union = new_union
end