lib/tapioca/commands/annotations.rb in tapioca-0.9.2 vs lib/tapioca/commands/annotations.rb in tapioca-0.9.3

- old
+ new

@@ -110,11 +110,11 @@ def fetch_annotations(gem_names) say("Fetching gem annotations from central repository... ", [:blue, :bold]) fetchable_gems = T.let(Hash.new { |h, k| h[k] = [] }, T::Hash[String, T::Array[String]]) gem_names.each_with_object(fetchable_gems) do |gem_name, hash| - @indexes.each { |uri, index| hash[gem_name] << uri if index.has_gem?(gem_name) } + @indexes.each { |uri, index| T.must(hash[gem_name]) << uri if index.has_gem?(gem_name) } end if fetchable_gems.empty? say(" Nothing to do") exit(0) @@ -191,11 +191,10 @@ # DO NOT EDIT MANUALLY # This file was pulled from a central RBI files repository. # Please run `#{default_command(:annotations)}` to update it. COMMENT - # Split contents into newlines and ensure trailing empty lines are included - contents = content.split("\n", -1) + contents = content.split("\n") if contents[0]&.start_with?("# typed:") && contents[1]&.empty? contents.insert(2, header).join("\n") else say_error("Couldn't insert file header for content: #{content} due to unexpected file format") content