Inline support on protoype
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
再現では lib/calculator.rb と bin/rbs のプロトタイプ rb を使用し、出力先は sig/lib/calculator.rbs です。まずそのコマンドを実行し、プロトタイプのパスをたどって、なぜインラインアノテーションがコメントのままになるのかを確認してください。生成されたシグネチャが、示されているとおり Integer のパラメータと戻り値の型を使用すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I was hoping to use inline documentation to generate proper type signatures, but it doesn't seem to be working at the moment. I have a PR with everything set up to demonstrate here.
Here is the gist, though:
I expect that this calculator.rb file:
class Calculator
# @rbs (Integer, Integer) -> Integer
def add(a, b)
a + b
end
end
And after running this command:
bin/rbs prototype rb lib/calculator.rb > sig/lib/calculator.rbs
Would produce this sig/lib/calculator.rbs file:
class Calculator
def add: (Integer a, Integer b) -> Integer
end
But at the moment, it produces this:
class Calculator
# @rbs (Integer, Integer) -> Integer
def add: (untyped a, untyped b) -> untyped
end
All this with the current specs:
❯ ruby --version
ruby 3.2.7 (2025-02-04 revision 02ec315244) [arm64-darwin23]
❯ bundle info rbs
* rbs (4.0.0.dev.4 8a97819)
Summary: Type signature for Ruby.
Homepage: https://github.com/ruby/rbs
Source Code: https://github.com/ruby/rbs.git
Changelog: https://github.com/ruby/rbs/blob/master/CHANGELOG.md
Path: /Users/aemadrid/.local/share/mise/installs/ruby/3.2.7/lib/ruby/gems/3.2.0/bundler/gems/rbs-8a97819d4419
Is this something that is in the works but not quite ready?
- 主要言語
- Ruby
- スター
- 2.2k
- フォーク
- 263
- 平均マージ
- 1日 20時間
- マージ済み PR(30日)
- 64
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ruby/rbs のほかの issue
-
InlineParser: `@rbs @ivar` annotation is reported as unused unless it is the first thing in the class body対応中かも @ksss が 50 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
bug f:request-creation professional
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
mysociety/alaveteli#9733 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
needs verification
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 13 日以内に返信
-
🐛 bug 👩💻 équipe CE 🧑🏭 entreprises
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
betagouv/conseillers-entreprises#4808 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100