Skip to content

Contracts can specify types for nonexistant arguments #291

Description

@riley-klingler

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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