From 334b69e5042f47f89c8780c1d7efa32d70c84786 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 13 Oct 2021 14:25:34 +0900 Subject: rb_id_serial_to_id: return unregistered ID as an internal ID ```ruby def foo(*); ->{ super }; end ``` This code makes anonymous parameters which is not registered as an ID. The problem is that when Ractors try to scan `getlocal` instructions, it puts the Symbol corresponding to the parameter in to a hash. Since it is not registered, we end up with a strange exception. This commit wraps the unregistered ID in an internal ID so that we get the same exception for `...` as `*`. Co-Authored-By: Aaron Patterson Co-Authored-By: John Hawthorn --- bootstraptest/test_ractor.rb | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'bootstraptest') diff --git a/bootstraptest/test_ractor.rb b/bootstraptest/test_ractor.rb index bf80b94cc7..ef1e6afcac 100644 --- a/bootstraptest/test_ractor.rb +++ b/bootstraptest/test_ractor.rb @@ -1502,4 +1502,40 @@ assert_equal "ok", %q{ "ok" } +assert_equal "ok", %q{ + def foo(*); ->{ super }; end + begin + Ractor.make_shareable(foo) + rescue Ractor::IsolationError + "ok" + end +} + +assert_equal "ok", %q{ + def foo(**); ->{ super }; end + begin + Ractor.make_shareable(foo) + rescue Ractor::IsolationError + "ok" + end +} + +assert_equal "ok", %q{ + def foo(...); ->{ super }; end + begin + Ractor.make_shareable(foo) + rescue Ractor::IsolationError + "ok" + end +} + +assert_equal "ok", %q{ + def foo((x), (y)); ->{ super }; end + begin + Ractor.make_shareable(foo([], [])) + rescue Ractor::IsolationError + "ok" + end +} + end # if !ENV['GITHUB_WORKFLOW'] -- cgit v1.2.3