diff --git a/Gemfile b/Gemfile index f804fd1..1c89ce0 100644 --- a/Gemfile +++ b/Gemfile @@ -9,5 +9,5 @@ gem "rake", "~> 13.2" gem "minitest", "~> 5.25" -gem "steep", "~> 1.8.3", require: false +gem "steep", "~> 1.9.0", require: false gem "strscan" diff --git a/Gemfile.lock b/Gemfile.lock index da57fbb..512f6c3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,9 @@ PATH remote: . specs: - rbs-inline (0.11.0) + rbs-inline (0.11.1) prism (>= 0.29, < 1.3) - rbs (>= 3.5.0) + rbs (>= 3.8.0) GEM remote: https://rubygems.org/ @@ -51,10 +51,10 @@ GEM rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rbs (3.6.1) + rbs (3.9.4) logger securerandom (0.4.1) - steep (1.8.3) + steep (1.9.4) activesupport (>= 5.1) concurrent-ruby (>= 1.1.10) csv (>= 3.0.9) @@ -65,16 +65,18 @@ GEM logger (>= 1.3.0) parser (>= 3.1) rainbow (>= 2.2.2, < 4.0) - rbs (~> 3.6.0) + rbs (~> 3.8) securerandom (>= 0.1) strscan (>= 1.0.0) terminal-table (>= 2, < 4) + uri (>= 0.12.0) strscan (3.1.2) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.6.0) + uri (1.0.3) PLATFORMS arm64-darwin-22 @@ -88,7 +90,7 @@ DEPENDENCIES minitest (~> 5.25) rake (~> 13.2) rbs-inline! - steep (~> 1.8.3) + steep (~> 1.9.0) strscan BUNDLED WITH diff --git a/lib/rbs/inline/ast/annotations.rb b/lib/rbs/inline/ast/annotations.rb index 9d7ca8c..6506e5a 100644 --- a/lib/rbs/inline/ast/annotations.rb +++ b/lib/rbs/inline/ast/annotations.rb @@ -494,7 +494,7 @@ def initialize(tree, source) end end - typename = TypeName(token_strs.join) + typename = TypeName.parse(token_strs.join) @clauses << RBS::AST::Directives::Use::SingleClause.new( type_name: typename, new_name: new_name, diff --git a/lib/rbs/inline/ast/declarations.rb b/lib/rbs/inline/ast/declarations.rb index fe658b27..8cd02cd 100644 --- a/lib/rbs/inline/ast/declarations.rb +++ b/lib/rbs/inline/ast/declarations.rb @@ -10,7 +10,7 @@ module ConstantUtil def type_name(node) case node when Prism::ConstantReadNode, Prism::ConstantPathNode - TypeName(node.full_name) + TypeName.parse(node.full_name) end end diff --git a/lib/rbs/inline/node_utils.rb b/lib/rbs/inline/node_utils.rb index ef50721..fb8fb10 100644 --- a/lib/rbs/inline/node_utils.rb +++ b/lib/rbs/inline/node_utils.rb @@ -8,7 +8,7 @@ module NodeUtils def type_name(node) case node when Prism::ConstantReadNode - TypeName(node.name.to_s) + TypeName.parse(node.name.to_s) end end end diff --git a/lib/rbs/inline/version.rb b/lib/rbs/inline/version.rb index 12edf97..910b740 100644 --- a/lib/rbs/inline/version.rb +++ b/lib/rbs/inline/version.rb @@ -2,6 +2,6 @@ module RBS module Inline - VERSION = "0.11.0" + VERSION = "0.11.1" end end diff --git a/lib/rbs/inline/writer.rb b/lib/rbs/inline/writer.rb index 8f63c8c..bc01d96 100644 --- a/lib/rbs/inline/writer.rb +++ b/lib/rbs/inline/writer.rb @@ -267,7 +267,7 @@ def translate_data_assign_decl(decl, rbs) #: void members = [:singleton, :instance].map do |kind| RBS::AST::Members::MethodDefinition.new( name: :members, - kind: kind, #: RBS::AST::MethodDefinition::Kind + kind: kind, #: RBS::AST::Members::MethodDefinition::kind overloads: [ RBS::AST::Members::MethodDefinition::Overload.new( method_type: RBS::MethodType.new( diff --git a/rbs-inline.gemspec b/rbs-inline.gemspec index e3f9fb4..d75b67b 100644 --- a/rbs-inline.gemspec +++ b/rbs-inline.gemspec @@ -29,5 +29,5 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.add_dependency "prism", ">= 0.29", "< 1.3" - spec.add_dependency "rbs", ">= 3.5.0" + spec.add_dependency "rbs", ">= 3.8.0" end diff --git a/rbs_collection.lock.yaml b/rbs_collection.lock.yaml index 5d6ff29..92df680 100644 --- a/rbs_collection.lock.yaml +++ b/rbs_collection.lock.yaml @@ -14,17 +14,17 @@ gems: source: type: stdlib - name: minitest - version: '0' + version: '5.25' source: - type: stdlib + type: git + name: ruby/gem_rbs_collection + revision: 43b158b1fc209960643ca6baf5f883b186997e8d + remote: https://github.com/ruby/gem_rbs_collection.git + repo_dir: gems - name: monitor version: '0' source: type: stdlib -- name: mutex_m - version: '0' - source: - type: stdlib - name: optparse version: '0' source: @@ -42,11 +42,11 @@ gems: source: type: git name: ruby/gem_rbs_collection - revision: 218cf130d31f63e110e350efc3fa265311b0f238 + revision: 43b158b1fc209960643ca6baf5f883b186997e8d remote: https://github.com/ruby/gem_rbs_collection.git repo_dir: gems - name: rbs - version: 3.6.1 + version: 3.9.4 source: type: rubygems - name: rdoc diff --git a/test/rbs/inline/annotation_parser_test.rb b/test/rbs/inline/annotation_parser_test.rb index 33998f6..60a47b7 100644 --- a/test/rbs/inline/annotation_parser_test.rb +++ b/test/rbs/inline/annotation_parser_test.rb @@ -3,6 +3,7 @@ require "test_helper" class RBS::Inline::AnnotationParserTest < Minitest::Test + include RBS include RBS::Inline def parse_comments(src) @@ -289,11 +290,11 @@ def test_inherits RUBY annots[0].annotations[0].tap do |annotation| - assert_equal TypeName("Object"), annotation.super_name + assert_equal TypeName.parse("Object"), annotation.super_name assert_equal [], annotation.args.map(&:to_s) end annots[0].annotations[1].tap do |annotation| - assert_equal TypeName("Array"), annotation.super_name + assert_equal TypeName.parse("Array"), annotation.super_name assert_equal ["String"], annotation.args.map(&:to_s) end annots[0].annotations[2].tap do |annotation| @@ -338,7 +339,7 @@ def test_use assert_instance_of AST::Annotations::Use, annotation annotation.clauses[0].tap do |clause| - assert_equal TypeName("::Foo"), clause.type_name + assert_equal TypeName.parse("::Foo"), clause.type_name assert_nil clause.new_name end end @@ -346,7 +347,7 @@ def test_use assert_instance_of AST::Annotations::Use, annotation annotation.clauses[0].tap do |clause| - assert_equal TypeName("Foo"), clause.type_name + assert_equal TypeName.parse("Foo"), clause.type_name assert_nil clause.new_name end end @@ -354,7 +355,7 @@ def test_use assert_instance_of AST::Annotations::Use, annotation annotation.clauses[0].tap do |clause| - assert_equal TypeName("Foo::Bar"), clause.type_name + assert_equal TypeName.parse("Foo::Bar"), clause.type_name assert_nil clause.new_name end end @@ -362,7 +363,7 @@ def test_use assert_instance_of AST::Annotations::Use, annotation annotation.clauses[0].tap do |clause| - assert_equal TypeName("Foo::bar"), clause.type_name + assert_equal TypeName.parse("Foo::bar"), clause.type_name assert_nil clause.new_name end end @@ -370,7 +371,7 @@ def test_use assert_instance_of AST::Annotations::Use, annotation annotation.clauses[0].tap do |clause| - assert_equal TypeName("Foo::_Bar"), clause.type_name + assert_equal TypeName.parse("Foo::_Bar"), clause.type_name assert_nil clause.new_name end end @@ -385,15 +386,15 @@ def test_use assert_instance_of AST::Annotations::Use, annotation annotation.clauses[0].tap do |clause| - assert_equal TypeName("Foo::Bar"), clause.type_name + assert_equal TypeName.parse("Foo::Bar"), clause.type_name assert_equal :Bar2, clause.new_name end annotation.clauses[1].tap do |clause| - assert_equal TypeName("Foo::bar"), clause.type_name + assert_equal TypeName.parse("Foo::bar"), clause.type_name assert_equal :bar2, clause.new_name end annotation.clauses[2].tap do |clause| - assert_equal TypeName("Foo::_Bar"), clause.type_name + assert_equal TypeName.parse("Foo::_Bar"), clause.type_name assert_equal :_Bar2, clause.new_name end end @@ -663,29 +664,29 @@ def test_module_decl_annotation annots[0].annotations[0].tap do |annotation| assert_instance_of AST::Annotations::ModuleDecl, annotation - assert_equal TypeName("Foo"), annotation.name + assert_equal TypeName.parse("Foo"), annotation.name assert_empty annotation.type_params assert_empty annotation.self_types end annots[0].annotations[1].tap do |annotation| assert_instance_of AST::Annotations::ModuleDecl, annotation - assert_equal TypeName("::Foo::Bar"), annotation.name + assert_equal TypeName.parse("::Foo::Bar"), annotation.name assert_empty annotation.type_params assert_empty annotation.self_types end annots[0].annotations[2].tap do |annotation| assert_instance_of AST::Annotations::ModuleDecl, annotation - assert_equal TypeName("Foo"), annotation.name + assert_equal TypeName.parse("Foo"), annotation.name annotation.type_params[0].tap do |param| assert_equal :A, param.name assert_equal "Integer", param.upper_bound.to_s end annotation.self_types[0].tap do |self_type| - assert_equal TypeName("BasicObject"), self_type.name + assert_equal TypeName.parse("BasicObject"), self_type.name assert_empty self_type.args end annotation.self_types[1].tap do |self_type| - assert_equal TypeName("_Each"), self_type.name + assert_equal TypeName.parse("_Each"), self_type.name assert_equal ["String"], self_type.args.map(&:to_s) end end @@ -705,18 +706,18 @@ def test_class_decl_annotation annots[0].annotations[0].tap do |annotation| assert_instance_of AST::Annotations::ClassDecl, annotation - assert_equal TypeName("Foo"), annotation.name + assert_equal TypeName.parse("Foo"), annotation.name assert_empty annotation.type_params assert_nil annotation.super_class end annots[0].annotations[1].tap do |annotation| assert_instance_of AST::Annotations::ClassDecl, annotation - assert_equal TypeName("Foo"), annotation.name + assert_equal TypeName.parse("Foo"), annotation.name annotation.type_params[0].tap do |param| assert_equal :A, param.name assert_equal "Integer", param.upper_bound.to_s end - assert_equal TypeName("Array"), annotation.super_class.name + assert_equal TypeName.parse("Array"), annotation.super_class.name assert_equal ["A"], annotation.super_class.args.map(&:to_s) end end diff --git a/test/rbs/inline/constant_util_test.rb b/test/rbs/inline/constant_util_test.rb index cb47fde..ab27bec 100644 --- a/test/rbs/inline/constant_util_test.rb +++ b/test/rbs/inline/constant_util_test.rb @@ -3,6 +3,7 @@ require "test_helper" class RBS::Inline::AST::Declarations::ConstantUtilTest < Minitest::Test + include RBS include RBS::Inline def parse_ruby(src) @@ -12,14 +13,14 @@ def parse_ruby(src) include RBS::Inline::AST::Declarations::ConstantUtil def test_read_constant_node - assert_equal TypeName("Foo"), type_name(parse_ruby("Foo")) + assert_equal TypeName.parse("Foo"), type_name(parse_ruby("Foo")) end def test_read_constant_path_node - assert_equal TypeName("Foo::Bar"), type_name(parse_ruby("Foo::Bar")) + assert_equal TypeName.parse("Foo::Bar"), type_name(parse_ruby("Foo::Bar")) end def test_read_constant_path_node_root - assert_equal TypeName("::Foo::Bar"), type_name(parse_ruby("::Foo::Bar")) + assert_equal TypeName.parse("::Foo::Bar"), type_name(parse_ruby("::Foo::Bar")) end end diff --git a/test/rbs/inline/declarations_test.rb b/test/rbs/inline/declarations_test.rb index 6e9817e..b965df9 100644 --- a/test/rbs/inline/declarations_test.rb +++ b/test/rbs/inline/declarations_test.rb @@ -3,6 +3,7 @@ require "test_helper" class RBS::Inline::AST::DeclarationsTest < Minitest::Test + include RBS include RBS::Inline def parse_ruby(src) @@ -17,7 +18,7 @@ class Hello decl = AST::Declarations::ClassDecl.new(result.value.statements.body[0], nil, nil) - assert_equal TypeName("Hello"), decl.class_name + assert_equal TypeName.parse("Hello"), decl.class_name end def test_class_decl__super @@ -28,6 +29,6 @@ class Hello < Object decl = AST::Declarations::ClassDecl.new(result.value.statements.body[0], nil, nil) - assert_equal TypeName("Hello"), decl.class_name + assert_equal TypeName.parse("Hello"), decl.class_name end end