-
Notifications
You must be signed in to change notification settings - Fork 65
Closed
Description
Mustermann::EqualityMap falls back to Hash if ObjectSpace::WeakMap is not defined.
mustermann/mustermann/lib/mustermann/equality_map.rb
Lines 21 to 23 in 6610061
| def self.new | |
| defined?(ObjectSpace::WeakMap) ? super : {} | |
| end |
However, this fallback doesn't seem correct as then
mustermann/mustermann/lib/mustermann/pattern.rb
Lines 58 to 59 in 6610061
| @map ||= EqualityMap.new | |
| @map.fetch(string, options) { super(string, options) { options } } |
ends up calling
Hash#fetch with both a default value argument and a block.This produces the warning:
.../gems/mustermann-1.0.2/lib/mustermann/pattern.rb:59: warning: block supersedes default value argument
And it means the second argument options is therefore ignored.
Mustermann::EqualityMap#fetch, used only if ObjectSpace::WeakMap is defined, has a different signature:
| def fetch(*key) |
I guess one easy fix is to define it like fetch(key) and in pattern.rb call it like
@map.fetch([string, options]) { super(string, options) { options } }See truffleruby/truffleruby#1375 (comment) for the original report in TruffleRuby.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels