diff --git a/lib/solargraph/rbs_map/conversions.rb b/lib/solargraph/rbs_map/conversions.rb index 79e71fc6f..0e69f577e 100644 --- a/lib/solargraph/rbs_map/conversions.rb +++ b/lib/solargraph/rbs_map/conversions.rb @@ -38,6 +38,8 @@ def load_environment_to_pins(loader) environment = RBS::Environment.from_loader(loader).resolve_type_names cursor = pins.length environment.declarations.each { |decl| convert_decl_to_pin(decl, Solargraph::Pin::ROOT_PIN) } + added_pins = pins[cursor..-1] + added_pins.each { |pin| pin.source = :rbs } end # @param decl [RBS::AST::Declarations::Base] diff --git a/lib/solargraph/type_checker.rb b/lib/solargraph/type_checker.rb index 5382995a4..4f7d14b2b 100644 --- a/lib/solargraph/type_checker.rb +++ b/lib/solargraph/type_checker.rb @@ -268,6 +268,7 @@ def call_problems base = base.base end closest = found.typify(api_map) if found + # @todo remove the internal_or_core? check at a higher-than-strict level if !found || found.is_a?(Pin::BaseVariable) || (closest.defined? && internal_or_core?(found)) unless closest.generic? || ignored_pins.include?(found) result.push Problem.new(location, "Unresolved call to #{missing.links.last.word}") diff --git a/spec/rbs_map/stdlib_map_spec.rb b/spec/rbs_map/stdlib_map_spec.rb index 161681435..bc2a134c2 100644 --- a/spec/rbs_map/stdlib_map_spec.rb +++ b/spec/rbs_map/stdlib_map_spec.rb @@ -56,4 +56,12 @@ expect(['Module', 'Module']).to include(return_type) end end + + it 'pins are marked as coming from RBS parsing' do + map = Solargraph::RbsMap::StdlibMap.load('yaml') + store = Solargraph::ApiMap::Store.new(map.pins) + constant_pins = store.get_constants('') + pin = constant_pins.first + expect(pin.source).to eq(:rbs) + end end