-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
kind:bugA bug in the code. Does not apply to documentation, specs, etc.A bug in the code. Does not apply to documentation, specs, etc.kind:regressionSomething that used to correctly work but no longer worksSomething that used to correctly work but no longer workstopic:stdlib:collection
Description
Consider the following code
result = Hash(String,Int32).new{ |h,k| h[k] = 0 }
result.update("NAME") { |v| v+1 }
pp! result
Running this under Crystal 1.9.2 gives the expected result of:
result # => {"NAME" => 1}
However, from Crystal 1.10.1 up to 1.11.2 (latest) I'm seeing:
result # => {"NAME" => 0, "NAME" => 1}
with two values for the same key!
Also,
pp! result.size
pp! result["NAME"]
Gives
result.size # => 2
result["NAME"] # => 0
Metadata
Metadata
Assignees
Labels
kind:bugA bug in the code. Does not apply to documentation, specs, etc.A bug in the code. Does not apply to documentation, specs, etc.kind:regressionSomething that used to correctly work but no longer worksSomething that used to correctly work but no longer workstopic:stdlib:collection