Skip to content

Conversation

@yhk1038
Copy link
Contributor

@yhk1038 yhk1038 commented Dec 28, 2025

Summary

  • Add new syntax for keyword arguments that distinguishes from positional args
  • { name: String } → keyword args (destructuring) → def foo(name:)
  • config: { host: String } → Hash literal parameter → def foo(config)
  • **opts: Type → double splat for forwarding → def foo(**opts)

Changes

  • Extend IR Parameter class with :keyword kind and interface_ref
  • Add keyword args parsing in parser.rb
  • Add keyword args code generation in compiler.rb
  • Extract common string utilities to StringUtils module
  • Add comprehensive e2e tests (12 test cases)

Test plan

  • 12 keyword args e2e tests pass
  • All 100 existing e2e tests pass (5 pending)
  • Parser and compiler unit tests pass (59 tests)

Closes #19

Add new syntax for keyword arguments that distinguishes from positional args:
- `{ name: String }` → keyword args (destructuring)
- `config: { host: String }` → Hash literal parameter
- `**opts: Type` → double splat for forwarding

Changes:
- Extend IR Parameter class with :keyword kind and interface_ref
- Add keyword args parsing in parser.rb
- Add keyword args code generation in compiler.rb
- Extract common string utilities to StringUtils module
- Add comprehensive e2e tests (12 test cases)
@yhk1038
Copy link
Contributor Author

yhk1038 commented Dec 28, 2025

ref. #19 (comment)

@yhk1038 yhk1038 merged commit e17b53c into main Dec 28, 2025
9 checks passed
@yhk1038 yhk1038 deleted the feature/keyword-args-type-annotation branch December 28, 2025 15:41
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.

[Enhancement] Distinguish keyword arguments from type annotations

2 participants