Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Constants defined under a payload alias (YAML = Psych) are emitted under the alias name, rejected by sorbet >= 0.6.13550

未关闭
#2,738 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 4 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
57/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
ruby
领域
tooling

调研方向

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, yaml 0.4.0 (a dependency of pagy)
  • bundle exec tapioca gem yaml generates:
# pkg:gem/yaml#lib/yaml.rb:69
YAML::LOADER_VERSION = T.let(T.unsafe(nil), String)
  • bundle exec srb tc reports 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 小时
30 天内合并 PR
11

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Shopify/tapioca 的其他 Issue

查看 Shopify/tapioca 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。