Skip to content

Commit

Permalink
Merge pull request #628 from Shopify/at-fix-rbs
Browse files Browse the repository at this point in the history
Handle `final` and `allow_incompatible` annotations during RBS translation
  • Loading branch information
Morriar authored Jan 15, 2025
2 parents 917948f + 86c07cc commit fea721e
Show file tree
Hide file tree
Showing 24 changed files with 17,761 additions and 19,109 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ GEM
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
rbi (0.2.2)
rbi (0.2.3)
prism (~> 1.0)
sorbet-runtime (>= 0.5.9204)
rdoc (6.10.0)
Expand Down
11 changes: 10 additions & 1 deletion lib/spoom/sorbet/sigs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,22 @@ def translate_method_sig(sig, node)
out = StringIO.new
p = RBI::RBSPrinter.new(out: out, indent: sig.loc&.begin_column)

if node.sigs.any?(&:is_final)
p.printn("# @final")
p.printt
end

if node.sigs.any?(&:is_abstract)
p.printn("# @abstract")
p.printt
end

if node.sigs.any?(&:is_override)
p.printn("# @override")
if node.sigs.any?(&:allow_incompatible_override)
p.printn("# @override(allow_incompatible: true)")
else
p.printn("# @override")
end
p.printt
end

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fea721e

Please sign in to comment.