Skip to content

Commit

Permalink
Merge pull request #2129 from ruby/dependabot/bundler/steep/multi-f10…
Browse files Browse the repository at this point in the history
…d3bcaf6

Bump rbs and steep in /steep
  • Loading branch information
soutaro authored Dec 10, 2024
2 parents 797eafe + 974136e commit 46b49c5
Show file tree
Hide file tree
Showing 17 changed files with 63 additions and 51 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ group :minitest do
end

group :typecheck_test do
gem "steep", "~> 1.8.0.pre", require: false
gem "steep", require: false
end
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,25 @@ GEM
drb (2.2.1)
ffi (1.17.0)
ffi (1.17.0-x86_64-darwin)
fileutils (1.7.2)
fileutils (1.7.3)
goodcheck (3.1.0)
marcel (>= 1.0, < 2.0)
psych (>= 3.1, < 5.0)
rainbow (>= 3.0, < 4.0)
strong_json (>= 1.1, < 2.2)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
json (2.8.2)
json (2.9.0)
json-schema (5.0.0)
addressable (~> 2.8)
language_server-protocol (3.17.0.3)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.1)
logger (1.6.2)
marcel (1.0.4)
memory_profiler (1.0.2)
minitest (5.25.1)
minitest (5.25.4)
mutex_m (0.3.0)
net-protocol (0.2.2)
timeout
Expand Down Expand Up @@ -123,7 +123,7 @@ GEM
ruby-progressbar (1.13.0)
securerandom (0.4.0)
stackprof (0.2.26)
steep (1.8.3)
steep (1.9.1)
activesupport (>= 5.1)
concurrent-ruby (>= 1.1.10)
csv (>= 3.0.9)
Expand All @@ -134,7 +134,7 @@ GEM
logger (>= 1.3.0)
parser (>= 3.1)
rainbow (>= 2.2.2, < 4.0)
rbs (~> 3.6.0)
rbs (~> 3.7.0)
securerandom (>= 0.1)
strscan (>= 1.0.0)
terminal-table (>= 2, < 4)
Expand Down Expand Up @@ -185,7 +185,7 @@ DEPENDENCIES
rubocop-on-rbs
rubocop-rubycw
stackprof
steep (~> 1.8.0.pre)
steep
tempfile
test-unit

Expand Down
2 changes: 1 addition & 1 deletion lib/rbs/annotate/rdoc_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def load
end

def find_class(typename)
classes = []
classes = [] #: Array[::RDoc::ClassModule]

@stores.each do |store|
if klass = store.find_class_or_module(typename.relative!.to_s)
Expand Down
16 changes: 8 additions & 8 deletions lib/rbs/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -554,11 +554,11 @@ def run_prototype(args, options)
when "rbi", "rb"
run_prototype_file(format, args)
when "runtime"
require_libs = []
relative_libs = []
require_libs = [] #: Array[String]
relative_libs = [] #: Array[String]
merge = false
todo = false
owners_included = []
owners_included = [] #: Array[Symbol]
outline = false
autoload = false

Expand Down Expand Up @@ -591,7 +591,7 @@ def run_prototype(args, options)
todo = true
end
opts.on("--method-owner CLASS", "Generate method prototypes if the owner of the method is [CLASS]") do |klass|
owners_included << klass
owners_included << klass.to_sym
end
opts.on("--outline", "Generates only module/class/constant declaration (no method definition)") do
outline = true
Expand All @@ -615,9 +615,9 @@ def autoload(name, path)
::Module.prepend(hook)
::Kernel.prepend(hook)

arguments = []
arguments = [] #: Array[[Module, interned]]
TracePoint.new(:call) do |tp|
base = tp.self.kind_of?(Module) ? tp.self : Kernel
base = tp.self.kind_of?(Module) ? tp.self : Kernel #: Module
name = (tp.binding or raise).local_variable_get(:name)
arguments << [base, name]
end.enable(target: hook.instance_method(:autoload), &block)
Expand Down Expand Up @@ -979,7 +979,7 @@ def run_annotate(args, options)
end

def test_opt options
opts = []
opts = [] #: Array[String]

opts.push(*options.repos.map {|dir| "--repo #{Shellwords.escape(dir)}"})
opts.push(*options.dirs.map {|dir| "-I #{Shellwords.escape(dir)}"})
Expand Down Expand Up @@ -1056,7 +1056,7 @@ def run_collection(args, options)
require 'bundler'

opts = collection_options(args)
params = {}
params = {} #: Hash[Symbol, untyped]
opts.order args.drop(1), into: params
config_path = options.config_path or raise
lock_path = Collection::Config.to_lockfile_path(config_path)
Expand Down
4 changes: 2 additions & 2 deletions lib/rbs/cli/diff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def initialize(argv:, library_options:, stdout: $stdout, stderr: $stderr)
# @type var type_name: String?
type_name = nil
library_options = library_options
before_path = []
after_path = []
before_path = [] #: Array[String]
after_path = [] #: Array[String]
detail = false

opt = OptionParser.new do |o|
Expand Down
4 changes: 3 additions & 1 deletion lib/rbs/collection/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ def sources
end

def gems
@data['gems'] ||= []
@data['gems'] ||= (
[] #: Array[gem_entry]
)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/rbs/definition_builder/ancestor_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def one_instance_ancestors(type_name)
super_args = super_class.args
else
super_name = BuiltinNames::Object.name
super_args = []
super_args = [] #: Array[Types::t]
end

super_name = env.normalize_module_name(super_name)
Expand Down Expand Up @@ -525,7 +525,7 @@ def singleton_ancestors(type_name, building_ancestors: [])

one_ancestors = one_singleton_ancestors(type_name)

ancestors = []
ancestors = [] #: Array[Definition::Ancestor::t]

case super_class = one_ancestors.super_class
when Definition::Ancestor::Instance
Expand Down Expand Up @@ -581,7 +581,7 @@ def interface_ancestors(type_name, building_ancestors: [])
building_ancestors.push self_ancestor

one_ancestors = one_interface_ancestors(type_name)
ancestors = []
ancestors = [] #: Array[Definition::Ancestor::t]

included_interfaces = one_ancestors.included_interfaces or raise
included_interfaces.each do |a|
Expand Down
2 changes: 1 addition & 1 deletion lib/rbs/environment_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Library < Struct.new(:name, :version, keyword_init: true)
DEFAULT_CORE_ROOT = Pathname(_ = __dir__) + "../../core"

def self.gem_sig_path(name, version)
requirements = []
requirements = [] #: Array[String]
requirements << version if version
spec = Gem::Specification.find_by_name(name, *requirements)
path = Pathname(spec.gem_dir) + "sig"
Expand Down
4 changes: 2 additions & 2 deletions lib/rbs/parser_aux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def self.buffer(source)
untyped
true
false
).each_with_object({}) do |keyword, hash|
hash[keyword] = nil
).each_with_object({}) do |keyword, hash| #$ Hash[String, bot]
hash[keyword] = _ = nil
end
end
end
15 changes: 9 additions & 6 deletions lib/rbs/prototype/rb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ def decls
def parse(string)
# @type var comments: Hash[Integer, AST::Comment]
comments = Ripper.lex(string).yield_self do |tokens|
code_lines = {}
tokens.each.with_object({}) do |token, hash|
code_lines = {} #: Hash[Integer, bool]
tokens.each.with_object({}) do |token, hash| #$ Hash[Integer, AST::Comment]
case token[1]
when :on_sp, :on_ignored_nl
# skip
Expand Down Expand Up @@ -643,11 +643,11 @@ def literal_to_type(node)
children = list.children
children.pop
else
children = []
children = [] #: Array[untyped]
end

key_types = []
value_types = []
key_types = [] #: Array[Types::t]
value_types = [] #: Array[Types::t]
children.each_slice(2) do |k, v|
if k
key_types << literal_to_type(k)
Expand All @@ -659,7 +659,10 @@ def literal_to_type(node)
end

if !key_types.empty? && key_types.all? { |t| t.is_a?(Types::Literal) }
fields = key_types.map { |t| t.literal }.zip(value_types).to_h
fields = key_types.map {|t|
t.is_a?(Types::Literal) or raise
t.literal
}.zip(value_types).to_h #: Hash[Types::Literal::literal, Types::t]
Types::Record.new(fields: fields, location: nil)
else
key_type = types_to_union_type(key_types)
Expand Down
14 changes: 9 additions & 5 deletions lib/rbs/prototype/rbi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ def initialize

def parse(string)
comments = Ripper.lex(string).yield_self do |tokens|
tokens.each.with_object({}) do |token, hash|
# @type var hash: Hash[Integer, AST::Comment]

tokens.each.with_object({}) do |token, hash| #$ Hash[Integer, AST::Comment]
if token[1] == :on_comment
line = token[0][0]
body = token[2][2..-1] or raise
Expand Down Expand Up @@ -325,11 +323,17 @@ def method_type(args_node, type_node, variables:, overloads:)
end
end
when :type_parameters
type_params = []
type_params = [] #: Array[AST::TypeParam]

each_arg args do |node|
if name = symbol_literal_node?(node)
type_params << name
type_params << AST::TypeParam.new(
name: name,
variance: :invariant,
upper_bound: nil,
location: nil,
default_type: nil
)
end
end

Expand Down
3 changes: 2 additions & 1 deletion lib/rbs/prototype/runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def skip_constant?(module_name:, name:)

def mixin_decls(type_name)
type_name_absolute = type_name.absolute!
(@mixin_decls_cache ||= {}).fetch(type_name_absolute) do
@mixin_decls_cache ||= {} #: Hash[TypeName, Array[AST::Members::Mixin]]
@mixin_decls_cache.fetch(type_name_absolute) do
@mixin_decls_cache[type_name_absolute] = @builder.env.class_decls[type_name_absolute].decls.flat_map do |d|
d.decl.members.select { |m| m.kind_of?(AST::Members::Mixin) }
end
Expand Down
8 changes: 5 additions & 3 deletions lib/rbs/prototype/runtime/value_object_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def build_member_accessors(ast_members_class)
kind: :instance,
location: nil,
comment: nil,
annotations: []
annotations: (
[] #: Array[AST::Annotation]
)
)
end
end
Expand Down Expand Up @@ -114,7 +116,7 @@ def add_decl_members(decl)
# | (?foo: untyped, ?bar: untyped) -> instance
def build_s_new
[:new, :[]].map do |name|
new_overloads = []
new_overloads = [] #: Array[AST::Members::MethodDefinition::Overload]

if CAN_CALL_KEYWORD_INIT_P
case @target_class.keyword_init?
Expand Down Expand Up @@ -234,7 +236,7 @@ def add_decl_members(decl)
# | (foo: untyped, bar: untyped) -> instance
def build_s_new
[:new, :[]].map do |name|
new_overloads = []
new_overloads = [] #: Array[AST::Members::MethodDefinition::Overload]

new_overloads << AST::Members::MethodDefinition::Overload.new(
annotations: [],
Expand Down
2 changes: 1 addition & 1 deletion lib/rbs/unit_test/type_assertions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def library(*libs)
@target = nil
end

@@env_cache = {}
@@env_cache = {} #: Hash[Array[String], RBS::Environment]

def env
@env = @@env_cache[@libs] ||=
Expand Down
4 changes: 2 additions & 2 deletions lib/rdoc_plugin/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def parse_attr_decl(decl:, context:, outer_name: nil)

def parse_include_decl(decl:, context:, outer_name: nil)
name = decl.name.to_s
outer_names = outer_name ? outer_name.to_s.split("::") : []
outer_names = outer_name ? outer_name.to_s.split("::") : [] #: Array[String]
qualified_name = ''
outer_names.each do |namespace|
qualified_name += namespace
Expand All @@ -124,7 +124,7 @@ def parse_include_decl(decl:, context:, outer_name: nil)

def parse_extend_decl(decl:, context:, outer_name: nil)
name = decl.name.to_s
outer_names = outer_name ? outer_name.to_s.split("::") : []
outer_names = outer_name ? outer_name.to_s.split("::") : [] #: Array[String]
qualified_name = ''
outer_names.each do |namespace|
qualified_name += namespace
Expand Down
4 changes: 2 additions & 2 deletions steep/Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
source "https://rubygems.org"

gem "rbs", "~> 3.6.1"
gem "steep", "~> 1.8.3"
gem "rbs", "~> 3.7.0"
gem "steep", "~> 1.9.0"
10 changes: 5 additions & 5 deletions steep/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rbs (3.6.1)
rbs (3.7.0)
logger
securerandom (0.4.0)
steep (1.8.3)
steep (1.9.1)
activesupport (>= 5.1)
concurrent-ruby (>= 1.1.10)
csv (>= 3.0.9)
Expand All @@ -55,7 +55,7 @@ GEM
logger (>= 1.3.0)
parser (>= 3.1)
rainbow (>= 2.2.2, < 4.0)
rbs (~> 3.6.0)
rbs (~> 3.7.0)
securerandom (>= 0.1)
strscan (>= 1.0.0)
terminal-table (>= 2, < 4)
Expand All @@ -71,8 +71,8 @@ PLATFORMS
ruby

DEPENDENCIES
rbs (~> 3.6.1)
steep (~> 1.8.3)
rbs (~> 3.7.0)
steep (~> 1.9.0)

BUNDLED WITH
2.5.16

0 comments on commit 46b49c5

Please sign in to comment.