tupl-tufts / rdl

Types, type checking, and contracts for Ruby
BSD 3-Clause "New" or "Revised" License
602 stars 38 forks source link

Support multiple-value return (e.g., return 1, 2) #79

Open mame opened 6 years ago

mame commented 6 years ago

This PR fixes the following error:

require "rdl"

extend RDL::Annotate

type "() -> [Integer, Integer]", typecheck: :now
def foo
  return 1, 2
end
/home/mame/local/lib/ruby/gems/2.5.0/gems/rdl-2.1.0/lib/rdl/typecheck.rb:158:in `error':  (RDL::Typecheck::StaticTypeError)
t.rb:7:3: error: got type `1' where return type `[Integer, Integer]' expected
t.rb:7:   return 1, 2
t.rb:7:   ^~~~~~~~~~~