Skip to content

Commit c564c94

Browse files
committed
Fix Ruby::UnannotatedEmptyCollection in steep check
``` Warning: header_parser/parser.rb:97:37: [warning] Empty hash doesn't have type annotation │ Diagnostic ID: Ruby::UnannotatedEmptyCollection │ └ stdout.each_line.with_object({}) do |line, hash| ~~ Detected 1 problem from 1 file rake aborted! Command failed with status (1): [steep check] /home/runner/work/ruby_header_parser/ruby_header_parser/Rakefile:24:in `block in <top (required)>' /home/runner/work/ruby_header_parser/ruby_header_parser/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>' /opt/hostedtoolcache/Ruby/3.3.6/x64/bin/bundle:25:in `load' /opt/hostedtoolcache/Ruby/3.3.6/x64/bin/bundle:25:in `<main>' Tasks: TOP => rbs (See full trace by running task with --trace) ```
1 parent 9415cb2 commit c564c94

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/ruby_header_parser/parser.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,11 @@ def extract_type_definitions
9393
def extract_enum_definitions
9494
stdout = execute_ctags("--c-kinds=e --fields=+n")
9595

96+
# Workaround for Ruby::UnannotatedEmptyCollection on steep 1.9.0+
97+
name_to_definition = {} #: Hash[String, RubyHeaderParser::EnumDefinition] # rubocop:disable Layout/LeadingCommentSpace
98+
9699
name_to_definitions =
97-
stdout.each_line.with_object({}) do |line, hash|
100+
stdout.each_line.with_object(name_to_definition) do |line, hash|
98101
parts = line.split("\t")
99102

100103
enum_name = Util.find_field(parts, "enum")

0 commit comments

Comments
 (0)