From 3ecd69767a46a449dd0802e8200f8dc9dbb0af52 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Thu, 20 Feb 2025 18:32:18 -0500 Subject: [PATCH] Fix `fetch_annotation` signature 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 --- lib/tapioca/commands/annotations.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/tapioca/commands/annotations.rb b/lib/tapioca/commands/annotations.rb index 9da9d4c9d..a9f25c5dc 100644 --- a/lib/tapioca/commands/annotations.rb +++ b/lib/tapioca/commands/annotations.rb @@ -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 @@ -142,7 +142,7 @@ 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) @@ -150,6 +150,7 @@ def fetch_annotation(repo_uris, gem_info) 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)) }