Skip to content

The Concurrent::Map default_proc is passed a Concurrent::Hash instead of the Concurrent::Map #993

Closed
@mensfeld

Description

@mensfeld

With concurrent-ruby 1.2.0 things work as expected. With 1.2.1 I get following error:

undefined method `compute_if_absent' for {}:Concurrent::Hash (NoMethodError)

relevant stacktrace:

gems/concurrent-ruby-1.2.1/lib/concurrent-ruby/concurrent/collection/map/non_concurrent_map_backend.rb:22:in `[]'

it's a divination of behaviour of map, working on repro 🙏

# Works in 1.2.0 but breaks in 1.2.1
@listeners = Concurrent::Map.new do |h, k|
  h.compute_if_absent(k) { Concurrent::Array.new }
end

@listeners[:a]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions