Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
14 changes: 8 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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/
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -88,7 +90,7 @@ DEPENDENCIES
minitest (~> 5.25)
rake (~> 13.2)
rbs-inline!
steep (~> 1.8.3)
steep (~> 1.9.0)
strscan

BUNDLED WITH
Expand Down
2 changes: 1 addition & 1 deletion lib/rbs/inline/ast/annotations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/rbs/inline/ast/declarations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/rbs/inline/node_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/rbs/inline/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

module RBS
module Inline
VERSION = "0.11.0"
VERSION = "0.11.1"
end
end
2 changes: 1 addition & 1 deletion lib/rbs/inline/writer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion rbs-inline.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 8 additions & 8 deletions rbs_collection.lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
37 changes: 19 additions & 18 deletions test/rbs/inline/annotation_parser_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require "test_helper"

class RBS::Inline::AnnotationParserTest < Minitest::Test
include RBS
include RBS::Inline

def parse_comments(src)
Expand Down Expand Up @@ -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|
Expand Down Expand Up @@ -338,39 +339,39 @@ 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
annots[0].annotations[1].tap do |annotation|
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
annots[0].annotations[2].tap do |annotation|
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
annots[0].annotations[3].tap do |annotation|
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
annots[0].annotations[4].tap do |annotation|
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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions test/rbs/inline/constant_util_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require "test_helper"

class RBS::Inline::AST::Declarations::ConstantUtilTest < Minitest::Test
include RBS
include RBS::Inline

def parse_ruby(src)
Expand All @@ -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
5 changes: 3 additions & 2 deletions test/rbs/inline/declarations_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require "test_helper"

class RBS::Inline::AST::DeclarationsTest < Minitest::Test
include RBS
include RBS::Inline

def parse_ruby(src)
Expand All @@ -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
Expand All @@ -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