Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#2,738 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@efegokdemir đang làm issue này rồi.

Từ ngày 28/10/2026.

  • #2754 của @efegokdemir — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
57/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
ruby
Lĩnh vực
tooling

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Ruby
Star
874
Fork
169
Merge trung bình
3 ngày 6 giờ
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

  • Không có Dockerfile hay tệp Docker Compose
  • Có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Shopify/tapioca

Tất cả issue của Shopify/tapioca

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.