NameError (undefined method `count_eq' for class `#<Class:Speculation::Utils>')
Closed this issue · 1 comments
dpkp commented
I ran across this issue when trying out an fdef with S.tuple args:
2.5.3 :001 > require 'speculation'
=> false
2.5.3 :002 > S = Speculation
=> Speculation
2.5.3 :003 > class Foo
2.5.3 :004?> def self.bar(a, b)
2.5.3 :005?> return true
2.5.3 :006?> end
2.5.3 :007?> end
=> :bar
2.5.3 :008 > S.fdef Foo.method(:bar), args: S.tuple(Object, Object)
=> #<Method: Foo.bar>
2.5.3 :009 > require 'speculation/test'
=> true
2.5.3 :010 > S::Test.instrument
=> [#<Method: Foo.bar>]
2.5.3 :011 > Foo.bar()
Traceback (most recent call last):
1: from (irb):11
NameError (undefined method `count_eq' for class `#<Class:Speculation::Utils>')
Did you mean? const_set
2.5.3 :012 > Foo.bar(1)
Traceback (most recent call last):
1: from (irb):12
NameError (undefined method `count_eq' for class `#<Class:Speculation::Utils>')
Did you mean? const_set
2.5.3 :013 > Foo.bar(1, 2)
=> true
2.5.3 :014 >
Traceback doesn't say this, but it seems like the source is here:
https://github.com/english/speculation/blob/master/lib/speculation/spec/tuple_spec.rb#L57
Is this just a typo and it should be Predicates.method(:count_eq)
? Happy to submit a PR if helpful.
fwiw, I'm running speculation 0.4.2
Also, thanks for putting so much effort into this excellent port!!