lib/raap/value/intersection.rb in raap-0.6.0 vs lib/raap/value/intersection.rb in raap-0.8.0

- old
+ new

@@ -15,22 +15,21 @@ instances.uniq! unless instances.count { |c| c.is_a?(::Class) } <= 1 raise ArgumentError, "intersection type must have at least one class instance type in `#{instances}`" end - base = instances.find { |c| c.is_a?(::Class) } || BasicObject + base = instances.find { |c| c.is_a?(::Class) } || Object c = Class.new(base) do instances.select { |i| !i.is_a?(::Class) }.each do |m| include(m) end - interfaces = type.types.select do |t| - t.instance_of?(::RBS::Types::Interface) - end - - interfaces.each do |interface| - Interface.define_method_from_interface(self, interface, size: size) + type.types.each do |t| + case t + when ::RBS::Types::Interface + Interface.define_method_from_interface(self, t, size: size) + end end end type = ::RBS::Types::ClassInstance.new(name: TypeName(base.name), args: [], location: nil) SymbolicCaller.new(Type.call_new_from(c, type, size: size)).eval end