lib/parlour/conflict_resolver.rb in parlour-0.6.1 vs lib/parlour/conflict_resolver.rb in parlour-0.7.0
- old
+ new
@@ -42,9 +42,21 @@
# Check for multiple definitions with the same name
grouped_by_name_children = namespace.children.group_by(&:name)
grouped_by_name_children.each do |name, children|
if children.length > 1
+ # Special case: do we have two methods, one of which is a class method
+ # and the other isn't? If so, do nothing - this is fine
+ next if children.length == 2 &&
+ children.all? { |c| c.is_a?(RbiGenerator::Method) } &&
+ children.count { |c| T.cast(c, RbiGenerator::Method).class_method } == 1
+
+ # Special case: do we have two attributes, one of which is a class
+ # attribute and the other isn't? If so, do nothing - this is fine
+ next if children.length == 2 &&
+ children.all? { |c| c.is_a?(RbiGenerator::Attribute) } &&
+ children.count { |c| T.cast(c, RbiGenerator::Attribute).class_attribute } == 1
+
# We found a conflict!
# Start by removing all the conflicting items
children.each do |c|
namespace.children.delete(c)
end