Enhance error message for Hash#[] when key is wrong type for default block#16442
Conversation
… of the wrong type
|
Maybe the message should not be |
|
How about |
|
Isn't this solution going to create issues re: lack of symmetry of the error messages? Why is the type checking being done only when the block is being given and not in other cases? The same method will return different errors depending on the internal state, violating the principle of the least surprise. |
|
Couldn't the error message could outline the key type mismatch regardless of the block? Another hint in favor to #8893 IMO. |
|
A maybe surprising property is that type identity is not a requirement for hash lookup. |
|
@straight-shoota The error message doesn't mention block at all though which makes this confusing. |
Hash#[] when key is wrong type for default block
Fixes #15057