Skip to content

Contracts confused by block with Maybe? #244

Open
@indigoviolet

Description

@indigoviolet
  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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions