New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError message renders String keys as Symbols #4729

Closed
olleolleolle opened this Issue Jul 31, 2017 · 0 comments

Comments

Projects
None yet
2 participants
@olleolleolle
Contributor

olleolleolle commented Jul 31, 2017

Environment

➜  ~ ruby -v
jruby 9.1.12.0 (2.3.3) 2017-06-15 33c6439 Java HotSpot(TM) 64-Bit Server VM 25.92-b14 on 1.8.0_92-b14 +jit [darwin-x86_64]
➜  ~ uname -a
Darwin Olles-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0: Tue Apr 11 16:00:51 PDT 2017; root:xnu-3248.60.11.5.3~1/RELEASE_X86_64 x86_64

Expected Behavior

2.4.0 :001 > { }.fetch("THE_MOPEDS")
KeyError: key not found: "THE_MOPEDS"
	from (irb):1:in `fetch'
	from (irb):1
	from /Users/olle/.rvm/rubies/ruby-2.4.0/bin/irb:11:in `<main>'

Actual Behavior

jruby-9.1.12.0 :012 > { }.fetch("THE_MOPEDS")
KeyError: key not found: :THE_MOPEDS
	from org/jruby/RubyHash.java:1189:in `fetch'
	from (irb):12:in `<eval>'
	from org/jruby/RubyKernel.java:1000:in `eval'
	from org/jruby/RubyKernel.java:1298:in `loop'
	from org/jruby/RubyKernel.java:1120:in `catch'
	from org/jruby/RubyKernel.java:1120:in `catch'
	from /Users/olle/.rvm/rubies/jruby-9.1.12.0/bin/irb:13:in `<main>'

rawrasaur added a commit to rawrasaur/jruby that referenced this issue Jul 31, 2017

Fix error message in Hash#fetch
In Hash#fetch, the old error message assumed the key was a symbol. Instead we
inspect it like in MRI. This closes jruby#4729.

@kares kares added this to the JRuby 9.2.0.0 milestone Aug 4, 2017

@headius headius closed this in #4730 Aug 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment