Skip to content

Fix TypeParam.rename to substitute variables in bounds and default types - #3068

Merged
soutaro merged 1 commit into
masterfrom
claude/fix-type-param-rename-substitution
Aug 10, 2026
Merged

Fix TypeParam.rename to substitute variables in bounds and default types#3068
soutaro merged 1 commit into
masterfrom
claude/fix-type-param-rename-substitution

Conversation

@soutaro

@soutaro soutaro commented Aug 6, 2026

Copy link
Copy Markdown
Member

TypeParam.rename built its substitution from the new names to themselves, making it an identity substitution, so type variables in upper/lower bounds and default types that reference other type parameters kept the old names. One visible consequence: validate_type_params raised a false GenericParameterMismatchError for compatible declarations like module M[A, B < _Foo[A]] and module M[X, Y < _Foo[X]]. The substitution now maps the old parameter names to the new variables.

The substitution in TypeParam.rename was built from the new names to
themselves, making it an identity substitution. Type variables in upper
bounds, lower bounds, and default types that reference other type
parameters were left with the old names. One visible consequence:
`validate_type_params` raised a false GenericParameterMismatchError for
declarations like `module M[A, B < _Foo[A]]` and `module M[X, Y < _Foo[X]]`,
which are compatible modulo renaming.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TBY8ct4HpkVkZNPdsNHEDE
@soutaro
soutaro added this pull request to the merge queue Aug 10, 2026
Merged via the queue into master with commit 6341786 Aug 10, 2026
24 checks passed
@soutaro
soutaro deleted the claude/fix-type-param-rename-substitution branch August 10, 2026 02:00
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.

2 participants