Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/spoom/rbs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ def node_rbs_comments(node)
location = location.join(continuation_comment.location)
end
continuation_comments.clear

next if string.start_with?("type ")

res.signatures.prepend(Signature.new(string, location))
elsif string.start_with?("#|")
continuation_comments << comment
Expand Down
22 changes: 22 additions & 0 deletions test/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,28 @@ def get_status
)
end

def test_translate_type_alias_before_method_sig_with_translate_last_overloads_strategy
assert_rewrites_rbs(
from: <<~RUBY,
class Example
#: type status = Symbol
#: () -> status
def status; end
end
RUBY

to_pretty_format_for_humans: <<~RUBY,
class Example
Status = T.type_alias { Symbol }
sig { returns(Status) }
def status; end
end
RUBY

overloads_strategy: :translate_last,
)
end

def test_translate_type_alias_with_generics
assert_rewrites_rbs(
from: <<~RUBY,
Expand Down
Loading