Constants defined under a payload alias (YAML = Psych) are emitted under the alias name, rejected by sorbet >= 0.6.13550
メンテナーはふだん 4 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start by reading Tapioca’s gem RBI generation path and how it resolves constant namespaces; the issue identifies the generated nested constant as the failing case. Reproduce with bundle exec tapioca gem yaml and bundle exec srb tc using the stated versions. Done means the generated RBI handles YAML::LOADER_VERSION without Sorbet error 4022 while the constant remains accessible as a String through YAML.
索引モデルが issue の本文から書いたものです。
説明
Summary
Since sorbet 0.6.13550 (sorbet/sorbet#10758; related: sorbet/sorbet#10767 for the net-http counterpart), Sorbet rejects any definition nested under a payload constant alias. The yaml gem RBI that tapioca generates now fails srb tc:
sorbet/rbi/gems/[email protected]:9: Redefining constant `YAML` as a class or module https://srb.help/4022
https://github.com/sorbet/sorbet/tree/b3a38a5fcb5cfeadd9031b3ddf513547f2c2f229/rbi/stdlib/yaml.rbi#L62: Previously defined as a static field here
62 |YAML = Psych # :nodoc:
Reproduction
- tapioca 0.20.0, sorbet 0.6.13550, Ruby 4.0.6,
yaml0.4.0 (a dependency ofpagy) bundle exec tapioca gem yamlgenerates:
# pkg:gem/yaml#lib/yaml.rb:69
YAML::LOADER_VERSION = T.let(T.unsafe(nil), String)
bundle exec srb tcreports the 4022 error above. Minimal case without tapioca: sorbet.run. sorbet 0.6.13544 accepts it.
The gem's lib/yaml.rb does YAML = Psych and later module YAML; LOADER_VERSION = "0.4.0"; end. At runtime YAML.equal?(Psych) is true, so the constant really lives on Psych.
Expected
When the namespace is an alias, tapioca should emit the constant under the alias target's real name (Psych::LOADER_VERSION = T.let(T.unsafe(nil), String)). Sorbet 0.6.13550 accepts that, and YAML::LOADER_VERSION still resolves to String. Alternatively, it could skip constants whose namespace is a payload alias.
Tapioca 0.20.0 already drops the module YAML; end line that older versions emitted. The same reasoning has to cover nested constants.
- 主要言語
- Ruby
- スター
- 874
- フォーク
- 167
- 平均マージ
- 5日 12時間
- マージ済み PR(30日)
- 11
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Shopify/tapioca のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
Shopify/tapioca#2662 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
Option to omit private methods from gem RBIs, with a per-gem opt-in対応中かも @efegokdemir が 2 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
メンテナーはふだん 4 日以内に返信
-
Improve `check-shims` performance対応中かも @KaanOzkan が 16 日前に担当しました。 オープン
Shopify/tapioca#2728 · 担当者 1 名 ·
メンテナーはふだん 4 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
メンテナーはふだん 4 日以内に返信
-
Prepending a module can cause `tapioca dsl` to produce an untyped signature対応中かも @KaanOzkan が 51 日前に担当しました。 オープンbug
Shopify/tapioca#2705 · 担当者 1 名 ·
メンテナーはふだん 4 日以内に返信
Shopify/tapioca の issue をすべて見る
似ている issue
-
message-patterns
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
sisimai/rb-sisimai#468 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 7 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 7 日以内に返信
-
bugsnag
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
JoeMcB/improvcoaches#827 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
TheOdinProject/curriculum#31465 ·
メンテナーはふだん 1 日以内に返信