Skip to content

Commit 204c4e0

Browse files
committed
Add runtime assert when losing information
1 parent 5fac5dd commit 204c4e0

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/solargraph/complex_type.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,13 @@ def namespaces
161161
# @param [Array<Object>] args
162162
def method_missing name, *args, &block
163163
return if @items.first.nil?
164-
return @items.first.send(name, *args, &block) if @items.first.respond_to?(name)
164+
if @items.first.respond_to?(name)
165+
if @items.count > 1
166+
Solargraph.assert_or_log(:complex_type_method_missing,
167+
"ComplexType being used as UniqueType: delegating #{name} to #{self.class} with items #{@items.map(&:to_s).join(', ')}")
168+
end
169+
return @items.first.send(name, *args, &block)
170+
end
165171
super
166172
end
167173

0 commit comments

Comments
 (0)