Skip to content

Commit 58f2f14

Browse files
committed
[Truffle] The evaluated block takes precedence over the default value in Hash#fetch.
1 parent 9a02641 commit 58f2f14

File tree

1 file changed

+2
-2
lines changed
  • core/src/main/ruby/jruby/truffle/core

1 file changed

+2
-2
lines changed

core/src/main/ruby/jruby/truffle/core/shims.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ class Hash
3030
def fetch(key, default=nil)
3131
if key?(key)
3232
self[key]
33-
elsif default
34-
default
3533
elsif block_given?
3634
yield(key)
35+
elsif default
36+
default
3737
else
3838
raise(KeyError, "key not found: #{key}")
3939
end

0 commit comments

Comments
 (0)