Skip to content

Skip constants nested under payload aliases - #2754

Open
efegokdemir wants to merge 1 commit into
Shopify:mainfrom
efegokdemir:efe/yaml-alias-rbi
Open

efegokdemir wants to merge 1 commit into
Shopify:mainfrom
efegokdemir:efe/yaml-alias-rbi

Conversation

@efegokdemir

Copy link
Copy Markdown

Motivation

Fixes #2738. Sorbet rejects constants nested under payload aliases such as YAML::LOADER_VERSION because YAML is already defined as Psych.

Implementation

Skip nested constants when an ancestor namespace is a payload alias, so Tapioca does not emit an RBI definition under the alias name.

Tests

  • bin/test spec/tapioca/gem/pipeline_spec.rb (140 tests, 443 assertions; 1 skipped)
  • bin/typecheck
  • bin/style
  • Reproduced with yaml 0.4.0; the generated RBI is empty and srb tc --no-config passes.

@efegokdemir
efegokdemir requested a review from a team as a code owner October 28, 2026 14:22
parts.pop

parts.each_index.any? do |index|
namespace = T.must(parts[0..index]).join("::")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
namespace = T.must(parts[0..index]).join("::")
namespace = parts.first(index).join("::")

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants