class Steep::AST::Types::Intersection
def self.build(types:, location: nil)
def self.build(types:, location: nil) types.flat_map do |type| if type.is_a?(Intersection) type.types else [type] end end.map do |type| case type when AST::Types::Any return AST::Types::Any.new(location: location) when AST::Types::Bot return AST::Types::Bot.new(location: location) when AST::Types::Top nil else type end end.compact.uniq.yield_self do |tys| if tys.size == 1 tys.first else new(types: tys.sort_by(&:hash), location: location) end end end