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
10 changes: 6 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ PATH
specs:
rbi (0.3.9)
prism (~> 1.0)
rbs (>= 3.4.4)
rbs (>= 4.0.1)

GEM
remote: https://rubygems.org/
Expand All @@ -29,13 +29,14 @@ GEM
parser (3.3.10.0)
ast (~> 2.4.1)
racc
prism (1.6.0)
prism (1.9.0)
racc (1.8.1)
rainbow (3.1.1)
rake (13.3.1)
rbs (4.0.0.dev.4)
rbs (4.0.1)
logger
prism (>= 1.3.0)
prism (>= 1.6.0)
tsort
regexp_parser (2.11.3)
require-hooks (0.2.2)
rexml (3.4.4)
Expand Down Expand Up @@ -87,6 +88,7 @@ GEM
thor (>= 1.2.0)
yard-sorbet
thor (1.4.0)
tsort (0.2.0)
unicode-display_width (3.2.0)
unicode-emoji (~> 4.1)
unicode-emoji (4.1.0)
Expand Down
3 changes: 2 additions & 1 deletion lib/rbi/rbs/type_translator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def translate(type)
when ::RBS::Types::Bases::Void
Type.void
when ::RBS::Types::ClassSingleton
Type.class_of(Type.simple(type.name.to_s))
type_parameter = type.args.first ? translate(type.args.first) : nil
Type.class_of(Type.simple(type.name.to_s), type_parameter)
when ::RBS::Types::ClassInstance
translate_class_instance(type)
when ::RBS::Types::Function
Expand Down
5 changes: 5 additions & 0 deletions lib/rbi/rbs_printer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1106,6 +1106,11 @@ def visit_class_of(type)
@string << "singleton("
visit(type.type)
@string << ")"
if (type_parameter = type.type_parameter)
@string << "["
visit(type_parameter)
@string << "]"
end
end

#: (Type::All type) -> void
Expand Down
2 changes: 1 addition & 1 deletion rbi.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
]

spec.add_dependency("prism", "~> 1.0")
spec.add_dependency("rbs", ">= 3.4.4")
spec.add_dependency("rbs", ">= 4.0.1")

spec.required_ruby_version = ">= 3.1"
end
Loading
Loading