From 74fece0a2a9405cbd9758a2a5594c0d08737cc76 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Wed, 8 Jan 2025 20:39:49 +0900 Subject: [PATCH] deps: Update rbs to 3.0 (#662) * deps: Update rbs to 3.0 * spec: Use fileutils for testing Solargraph::Rbs::StdlibMap The "set" has been merged into the Ruby Core and RBS has been drop support since v3.0. So current spec implementation will not work with RBS-3.x. --- lib/solargraph/rbs_map/conversions.rb | 12 ++++++------ solargraph.gemspec | 2 +- spec/rbs_map/stdlib_map_spec.rb | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/solargraph/rbs_map/conversions.rb b/lib/solargraph/rbs_map/conversions.rb index ecd5322f2..e52c94923 100644 --- a/lib/solargraph/rbs_map/conversions.rb +++ b/lib/solargraph/rbs_map/conversions.rb @@ -40,7 +40,7 @@ def convert_decl_to_pin decl, closure when RBS::AST::Declarations::Interface # STDERR.puts "Skipping interface #{decl.name.relative!}" interface_decl_to_pin decl - when RBS::AST::Declarations::Alias + when RBS::AST::Declarations::TypeAlias type_aliases[decl.name.to_s] = decl when RBS::AST::Declarations::Module module_decl_to_pin decl @@ -222,12 +222,12 @@ def method_def_to_pin decl, closure # @param decl [RBS::AST::Members::MethodDefinition] # @param pin [Pin::Method] def method_def_to_sigs decl, pin - decl.types.map do |type| - parameters, return_type = parts_of_function(type, pin) - block = if type.block - Pin::Signature.new(*parts_of_function(type.block, pin)) + decl.overloads.map do |overload| + parameters, return_type = parts_of_function(overload.method_type, pin) + block = if overload.method_type.block + Pin::Signature.new(*parts_of_function(overload.method_type.block, pin)) end - return_type = ComplexType.try_parse(method_type_to_tag(type)) + return_type = ComplexType.try_parse(method_type_to_tag(overload.method_type)) Pin::Signature.new(parameters, return_type, block) end end diff --git a/solargraph.gemspec b/solargraph.gemspec index 938720dc0..5d1c31b57 100755 --- a/solargraph.gemspec +++ b/solargraph.gemspec @@ -34,7 +34,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'observer', '~> 0.1' s.add_runtime_dependency 'ostruct', '~> 0.6' s.add_runtime_dependency 'parser', '~> 3.0' - s.add_runtime_dependency 'rbs', '~> 2.0' + s.add_runtime_dependency 'rbs', '~> 3.0' s.add_runtime_dependency 'reverse_markdown', '~> 2.0' s.add_runtime_dependency 'rubocop', '~> 1.38' s.add_runtime_dependency 'thor', '~> 1.0' diff --git a/spec/rbs_map/stdlib_map_spec.rb b/spec/rbs_map/stdlib_map_spec.rb index 80734530a..8a3347653 100644 --- a/spec/rbs_map/stdlib_map_spec.rb +++ b/spec/rbs_map/stdlib_map_spec.rb @@ -1,7 +1,7 @@ describe Solargraph::RbsMap::StdlibMap do it "finds stdlib require paths" do - rbs_map = Solargraph::RbsMap::StdlibMap.load('set') - pin = rbs_map.path_pin('Set#add') + rbs_map = Solargraph::RbsMap::StdlibMap.load('fileutils') + pin = rbs_map.path_pin('FileUtils#chdir') expect(pin).to be end