contracts.ruby
contracts.ruby copied to clipboard
Contracts confused by block with `Maybe`?
class Bar
include Contracts::Builtin
include Contracts::Core
Contract String, Maybe[Integer], Func[Any => Any] => Any
def self.contract_foo(a, b=nil, &blk)
puts [a, b, blk].to_json
end
end
[26] development (main)> Bar.contract_foo "a" do
[26] development (main)* end
ParamContractError: Contract violation for argument 2 of 2:
Expected: (Integer or nil),
Actual: #<Proc:0x0055dbc44fc388@(pry):31>
See https://github.com/egonSchiele/contracts.ruby/pull/214
I can reproduce