egonSchiele / contracts.ruby

Contracts for Ruby.
http://egonschiele.github.com/contracts.ruby
BSD 2-Clause "Simplified" License
1.44k stars 82 forks source link

Contracts can specify types for nonexistant arguments #291

Open riley-klingler opened 4 years ago

riley-klingler commented 4 years ago

Example code:

Class A
    include Contracts::Core
    include Contracts::Builtin

   Contract Integer, Integer => String
   def self.hello
      return "Hello world!"
   end
end

puts A.hello

Actual behavior

No errors are raised

Expected behavior

I would expect this would an error, because the contract specifies hello takes two integers as arguments, and it is being passed none. I understand that this could be considered fine, as the code would work fine (without type errors) without the contract, but that is no different from any other incorrectly specified contract.