Commit 29d382a
Fix RBS::ParsingError when block argument is assigned to rest keywords hash (#358)
The following code caused RBS::ParsingError:
```ruby
# issue.rb
def foo(**opts, &block)
opts[:callback] = block
opts
end
foo(key: 1) {}
```
```bash
$ bin/typeprof issue.rb
# TypeProf 0.31.1
# issue.rb
/Users/sinsoku/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rbs-3.10.0/lib/rbs/parser_aux.rb:10:in 'RBS::Parser._parse_type': RBS::ParsingError
from /Users/sinsoku/.local/share/mise/installs/ruby/4.0.0/lib/ruby/gems/4.0.0/gems/rbs-3.10.0/lib/rbs/parser_aux.rb:10:in 'RBS::Parser.parse_type'
from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/type.rb:20:in 'TypeProf::Core::Type.extract_hash_value_type'
from /Users/sinsoku/ghq/github.com/ruby/typeprof/lib/typeprof/core/graph/box.rb:647:in 'TypeProf::Core::MethodDefBox#show'
```
Type::Proc#show returned "<Proc>" which is not valid RBS syntax.
MethodDefBox#show calls extract_hash_value_type to parse rest_keywords
type with RBS::Parser, causing ParsingError when the type contains "<Proc>".
Changed Type::Proc#show to return "Proc" for RBS compatibility.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent 491d555 commit 29d382a
2 files changed
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
| 191 | + | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
0 commit comments