Skip to content

Extract per-declaration type param alignment into entry-level align_params - #3070

Merged
soutaro merged 2 commits into
claude/module-self-type-param-alignment-2wpbjafrom
claude/entry-align-params
Aug 7, 2026
Merged

Extract per-declaration type param alignment into entry-level align_params#3070
soutaro merged 2 commits into
claude/module-self-type-param-alignment-2wpbjafrom
claude/entry-align-params

Conversation

@soutaro

@soutaro soutaro commented Aug 7, 2026

Copy link
Copy Markdown
Member

Stacked on #3067.

The substitution that renames a declaration's type parameters to the entry's type parameters was built inline in five places: MethodBuilder#build_instance, DefinitionBuilder#define_instance, AncestorBuilder#mixin_ancestors, ModuleEntry#self_types, and AncestorBuilder#validate_super_class!. This PR defines it once as ModuleEntry#align_params / ClassEntry#align_params and uses it from all of them, making the decl-to-entry name translation a defined entry-level operation instead of a copy-pasted idiom. The method returns nil when the declaration already uses the entry's type parameter names — the common case — so callers skip the substitution entirely.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TBY8ct4HpkVkZNPdsNHEDE


Generated by Claude Code

claude added 2 commits August 7, 2026 00:41
…arams

The substitution that renames a declaration's type parameters to the
entry's type parameters was built inline in five places: MethodBuilder,
DefinitionBuilder#define_instance, AncestorBuilder#mixin_ancestors,
ModuleEntry#self_types, and AncestorBuilder#validate_super_class!.
Define it once as ModuleEntry#align_params / ClassEntry#align_params and
use it from all of them. The method returns nil when the declaration
already uses the entry's type parameter names, so the callers can skip
the substitution in the common case.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TBY8ct4HpkVkZNPdsNHEDE
Type params validation runs before the alignment, so the arity mismatch
raises GenericParameterMismatchError instead of building a broken
substitution.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TBY8ct4HpkVkZNPdsNHEDE
@soutaro
soutaro merged commit e51608f into claude/module-self-type-param-alignment-2wpbja Aug 7, 2026
24 checks passed
@soutaro
soutaro deleted the claude/entry-align-params branch August 7, 2026 01:55

soutaro commented Aug 7, 2026

Copy link
Copy Markdown
Member Author

Folded into #3067.


Generated by Claude Code

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