Skip to content

Add keyword argument support to type inference#49

Merged
dak2 merged 1 commit into
mainfrom
add-keyword-argument-support
Mar 8, 2026
Merged

Add keyword argument support to type inference#49
dak2 merged 1 commit into
mainfrom
add-keyword-argument-support

Conversation

@dak2

@dak2 dak2 commented Mar 8, 2026

Copy link
Copy Markdown
Owner

Summary

Ruby's keyword arguments (def foo(name:, age: 0)) are widely used but were
previously ignored by the type checker, causing incomplete type propagation
when methods were called with keyword arguments.

Changes

  • Parse keyword parameters (required and optional) in method definitions
    and register them as named vertices in the method registry
  • Separate positional and keyword arguments at call sites by detecting
    KeywordHashNode in the argument list
  • Propagate keyword argument types to parameter vertices by name matching
    in MethodCallBox, including through .new → initialize forwarding

Test plan

  • Run cd rust && cargo test --lib to verify all Rust tests pass
  • Run bundle exec rake test to verify all Ruby integration tests pass

🤖 Generated with Claude Code

Ruby's keyword arguments (def foo(name:, age: 0)) are widely used but were
previously ignored by the type checker, causing incomplete type propagation
when methods were called with keyword arguments.

This change implements full keyword argument support across the type
inference pipeline:

- Parse keyword parameters (required and optional) in method definitions
  and register them as named vertices in the method registry
- Separate positional and keyword arguments at call sites by detecting
  KeywordHashNode in the argument list
- Propagate keyword argument types to parameter vertices by name matching
  in MethodCallBox, including through .new → initialize forwarding

Design based on v0.1.8-D-keyword-args.md specification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dak2 dak2 merged commit 9a81910 into main Mar 8, 2026
2 checks passed
@dak2 dak2 deleted the add-keyword-argument-support branch March 8, 2026 05:58
@dak2 dak2 mentioned this pull request Mar 9, 2026
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.

1 participant