From eb505c343c790bd8ef02458a7aa20a6a7f244086 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 15 May 2023 11:21:18 +0900 Subject: [PATCH 1/2] deps: Update rbs to 3.0 --- lib/solargraph/rbs_map/conversions.rb | 12 ++++++------ solargraph.gemspec | 2 +- 2 files changed, 7 insertions(+), 7 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 4e6ddde61..ee06d2559 100755 --- a/solargraph.gemspec +++ b/solargraph.gemspec @@ -29,7 +29,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'kramdown', '~> 2.3' s.add_runtime_dependency 'kramdown-parser-gfm', '~> 1.1' 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' From e39bf764f67cf42273da22b615b84a08c0c70965 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 15 May 2023 11:21:54 +0900 Subject: [PATCH 2/2] 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. --- spec/rbs_map/stdlib_map_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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