Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
TypeError raised by JRuby during keyword argument checking while the call is perfectly legit #3760
Noteworthy gems: facets (but not only very little of it activated), concurrent-ruby. The code that causes the problem is not multithreaded.
I'm calling a method whose signature is
I expect to enter the called method.
JRuby raises a TypeError exception complaining that
referenced this issue
Mar 27, 2016
OK, so narrowed it down to JRuby having different rules than MRI when a method is given a hash as argument, and also has keyword arguments.
I've been testing a few cases, and it seems that MRI's rule in this case is that any key that is not a symbol is fed into the argument (that does include strings), any key that is a symbol is interpreted as a keyword argument
The problem appears to be that we try to coerce keys to a string-like thing when we are walking keys we're not sure should be in the kwargs processing. We need the string for the hash lookup. I believe we should only perform this search for keys that actually are string-like, or perhaps only symbols.
This is unlikely to make 9.1 because of some key issues we have to fix:
The main piece that's missing is that we don't treat an incoming kwarg-able hash as potentially containing both kwarg symbols and non-kwarg pairs. We need a step before arity-checking and argument assignment that breaks apart such hashes into kwargable and non-kwargable parts.