Skip to content

Func contract's return value isn't enforced with blocks #242

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
indigoviolet opened this issue Nov 23, 2016 · 2 comments
Closed

Func contract's return value isn't enforced with blocks #242

indigoviolet opened this issue Nov 23, 2016 · 2 comments

Comments

@indigoviolet
Copy link
Contributor

Contract Func[Num=>Num] => nil
def foo(&blk)
  result = blk.call(2)
  nil
end

Contract Func[Num=>Num] => nil
def bar(blk)
  result = blk.call(2)
  nil
end

foo { |x| x.to_s }  # no error
bar lambda { |x| x.to_s } # error
@indigoviolet indigoviolet changed the title Func contract's return value with blocks Func contract's return value isn't enforced with blocks Nov 23, 2016
@egonSchiele
Copy link
Owner

I can reproduce

egonSchiele pushed a commit that referenced this issue Feb 24, 2017
…s properly (#251)

* fixes issue #242 - contract's return value is now enforced with blocks properly

* more robust if condition

* handle block with keyword arguments and change Gemfile syntax to work
with travis properly
@egonSchiele
Copy link
Owner

This is fixed in v0.15.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants