Skip to content

Raise when type parameters collide during sig to RBS translation - #1017

Open
Hashim1999164 wants to merge 2 commits into
Shopify:mainfrom
Hashim1999164:fix/rbs-type-param-shadowing
Open

Raise when type parameters collide during sig to RBS translation#1017
Hashim1999164 wants to merge 2 commits into
Shopify:mainfrom
Hashim1999164:fix/rbs-type-param-shadowing

Conversation

@Hashim1999164

@Hashim1999164 Hashim1999164 commented Aug 18, 2026

Copy link
Copy Markdown

Summary

  • RBS type variables shadow constants and class type members that share the same name, so a translated sig can fail to parse or drop a type error
  • When a method type parameter collides with a constant path or class type member in the same signature, raise an error that asks the user to rename the type parameter

Closes #1012

Test plan

  • bundle exec rake test

@Hashim1999164
Hashim1999164 requested a review from a team as a code owner August 18, 2026 18:44
@jesse-shopify

Copy link
Copy Markdown
Contributor

My concern with this is renaming a user's type name can lead to confusion if that name is surfaced later. I'm thinking a better strategy will be to raise an error suggesting the user rename to avoid the collision. That keeps the user in control and the names consistent.

@Hashim1999164

Copy link
Copy Markdown
Author

@jesse-shopify hi, i understand your concern. Can you please take it up from here. I wint be available upcoming few days. Thanks

@Hashim1999164 Hashim1999164 changed the title Rename colliding type parameters when translating sigs to RBS Raise when type parameters collide during sig to RBS translation Aug 26, 2026
@Hashim1999164

Copy link
Copy Markdown
Author

@jesse-shopify I switched this to raise instead of renaming. The error asks the user to rename the type parameter so the original names stay consistent and they stay in control.

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.

srb sigs translate: type parameter shadows a type name used in the same signature

2 participants