Skip to content

Commit

Permalink
Fix fetch_annotation signature
Browse files Browse the repository at this point in the history
This code works by miracle.

We call `fetch_annotation` within a `select` but the method return `void`.
It only works because the `T::Private::Types::Void::VOID` used by
`sorbet-runtime` to replace the actual value is truthy.

Signed-off-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
  • Loading branch information
Morriar committed Feb 20, 2025
1 parent 73381f3 commit 3ecd697
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/tapioca/commands/annotations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def fetch_annotations(project_gems)
fetched_gems.keys.map(&:name).sort
end

sig { params(repo_uris: T::Array[String], gem_info: GemInfo).void }
sig { params(repo_uris: T::Array[String], gem_info: GemInfo).returns(T::Boolean) }
def fetch_annotation(repo_uris, gem_info)
gem_name = gem_info.name
gem_version = gem_info.version
Expand All @@ -142,14 +142,15 @@ def fetch_annotation(repo_uris, gem_info)
end

content = merge_files(gem_name, contents.compact)
return unless content
return false unless content

content = apply_typed_override(gem_name, content)
content = filter_versions(gem_version, content)
content = add_header(gem_name, content)

say("\n Fetched #{set_color(gem_name, :yellow, :bold)}", :green)
create_file(@outpath.join("#{gem_name}.rbi"), content)
true
end

sig { params(repo_uri: String, path: String).returns(T.nilable(String)) }
Expand Down

0 comments on commit 3ecd697

Please sign in to comment.