summaryrefslogtreecommitdiff
path: root/defs
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2022-07-28 16:41:46 -0700
committerJohn Hawthorn <john@hawthorn.email>2022-08-04 14:48:47 -0700
commit70b60d24b9c3859a859853ddb2e17c603bd3485b (patch)
tree118155ed5c7e4d832ae51b48ca57867e08718ee5 /defs
parent1e7a2415a4c69aa64c9c2a561197bf9cfc5a91f8 (diff)
downloadruby-70b60d24b9c3859a859853ddb2e17c603bd3485b.tar.gz
Fix inconsistency with opt_aref_with
opt_aref_with is an optimized instruction for accessing a Hash using a non-frozen string key (ie. from a file without frozen_string_literal). It attempts to avoid allocating the string, and instead silently using a frozen string (hash string keys are always fstrings). Because this is just an optimization, it should be invisible to the user. However, previously this optimization was could be seen via hashes with default procs. For example, previously: h = Hash.new { |h, k| k.frozen? } str = "foo" h[str] # false h["foo"] # true when optimizations enabled This commit checks that the Hash doesn't have a default proc when using opt_aref_with.
Diffstat (limited to 'defs')
0 files changed, 0 insertions, 0 deletions