diff options
author | Richard Böhme <[email protected]> | 2025-05-21 18:14:28 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2025-05-21 22:12:34 +0900 |
commit | 9a41d76b830d1f1feed46e0c3c8640a413f0e94e (patch) | |
tree | 1a3dc16ccaaacc678eda1878f9a00c8cc5353200 | |
parent | 081a44f586b19e66be5a22d2f7d29b34de453efb (diff) |
Fix one-by-one error of numbered parameter ID
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13395
-rw-r--r-- | proc.c | 2 | ||||
-rw-r--r-- | test/ruby/test_proc.rb | 4 |
2 files changed, 5 insertions, 1 deletions
@@ -507,7 +507,7 @@ bind_local_variables(VALUE bindval) int rb_numparam_id_p(ID id) { - return (tNUMPARAM_1 << ID_SCOPE_SHIFT) <= id && id < ((tNUMPARAM_1 + 10) << ID_SCOPE_SHIFT); + return (tNUMPARAM_1 << ID_SCOPE_SHIFT) <= id && id < ((tNUMPARAM_1 + 9) << ID_SCOPE_SHIFT); } /* diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 35aa16063d..f6b9e6d063 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -1637,6 +1637,10 @@ class TestProc < Test::Unit::TestCase assert_equal(3, b.local_variable_get(:when)) assert_equal(4, b.local_variable_get(:begin)) assert_equal(5, b.local_variable_get(:end)) + + assert_raise_with_message(NameError, /local variable \Wdefault\W/) { + binding.local_variable_get(:default) + } end def test_local_variable_set |