Merged
Conversation
Add comprehensive support for RBS Record types ({ key: Type }) in TypeProf
with field access, type checking, and error handling capabilities.
## Core Implementation
* **SigTyRecordNode**: Parse and process Record type definitions from RBS
* **Record class**: New type class with field access and matching support
* **Hash integration**: Shared builtin support for Hash and Record types
* **Type compatibility**: Enable Hash-Record interoperability in method calls
## Features
* Field access via [] operator (e.g., record[:name] -> String)
* Proper type checking for Record parameters and return values
* Union type support for Record field values
* Graceful error handling for non-existent field access (returns untyped)
* Hash[Symbol, T] to Record type compatibility
## Test Coverage
Added 9 comprehensive test files covering:
- Basic Record type usage and type propagation
- Field access and nested Record structures
- Hash-Record type compatibility scenarios
- Error handling for invalid field access
- Optional Record types and empty Records
- Array integration with Record types
## Technical Details
Record types are internally represented with a base Hash type to maintain
compatibility with Ruby's hash-like access patterns. Field values are
properly unified into a union type for the underlying Hash value type.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
mame
approved these changes
Aug 8, 2025
Member
|
Sorry for very late review! TBH I don't fully understand the changes, but I'd like to give it a try. Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add comprehensive support for RBS Record types ({ key: Type }) in TypeProf with field access, type checking, and error handling capabilities.
Core Implementation
Features
Test Coverage
Added 9 comprehensive test files covering:
Technical Details
Record types are internally represented with a base Hash type to maintain compatibility with Ruby's hash-like access patterns. Field values are properly unified into a union type for the underlying Hash value type.
🤖 Generated with Claude Code