diff --git a/lib/solargraph/pin/delegated_method.rb b/lib/solargraph/pin/delegated_method.rb index c60240ddb..25aab0986 100644 --- a/lib/solargraph/pin/delegated_method.rb +++ b/lib/solargraph/pin/delegated_method.rb @@ -37,6 +37,11 @@ def initialize(method: nil, receiver: nil, name: method&.name, receiver_method_n end end + def resolvable?(api_map) + resolve_method(api_map) + !!@resolved_method + end + private # Resolves the receiver chain and method name to a method pin, resetting any previously resolution. diff --git a/lib/solargraph/type_checker.rb b/lib/solargraph/type_checker.rb index 059caaeff..35c90b0cf 100644 --- a/lib/solargraph/type_checker.rb +++ b/lib/solargraph/type_checker.rb @@ -259,7 +259,10 @@ def argument_problems_for chain, api_map, block_pin, locals, location base = chain until base.links.length == 1 && base.undefined? pins = base.define(api_map, block_pin, locals) - if pins.first.is_a?(Pin::Method) + + if pins.first.is_a?(Pin::DelegatedMethod) && !pins.first.resolvable?(api_map) + # Do nothing, as we can't find the actual method implementation + elsif pins.first.is_a?(Pin::Method) # @type [Pin::Method] pin = pins.first ap = if base.links.last.is_a?(Solargraph::Source::Chain::ZSuper)