Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[issue] show to_proc bug #49

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Conversation

ptarjan
Copy link
Contributor

@ptarjan ptarjan commented Sep 13, 2017

I don't know how to fix this one. I tried but the handling of :to_proc wasn't making sense to me. It seems to be trying to resolve bar based on the scoping immediately instead of later when it is called, and the shape of the call seemed to not know about how it was being called.

The assignment to a and the assignment to b should be typechecked the same way. a succeed and b fails with


  1) Error:
TestTypecheck#test_to_proc:
RDL::Typecheck::StaticTypeError:
/Users/pt/stripe/rdl/test/test_typecheck.rb:1666:28: error: block argument has type `() -> Integer' but expecting type `(TestTypecheck::ToProc) -> u'
/Users/pt/stripe/rdl/test/test_typecheck.rb:1666:         b = [self.new].map(&:bar)
/Users/pt/stripe/rdl/test/test_typecheck.rb:1666:                            ^~~~~
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:158:in `error'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:1441:in `tc_block'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:1298:in `block (2 levels) in tc_send_one_recv'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:1294:in `each'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:1294:in `block in tc_send_one_recv'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:1291:in `each'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:1291:in `tc_send_one_recv'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:1214:in `block in tc_send'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:1213:in `each'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:1213:in `tc_send'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:678:in `block in tc'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:140:in `scope_merge'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:655:in `tc'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:476:in `tc'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:913:in `block in tc'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:913:in `each'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:913:in `tc'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:247:in `block in typecheck'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:226:in `each'
    /Users/pt/stripe/rdl/lib/rdl/typecheck.rb:226:in `typecheck'
    /Users/pt/stripe/rdl/lib/rdl/wrap.rb:57:in `block in foo'
    /Users/pt/stripe/rdl/lib/rdl/switch.rb:13:in `off'
    /Users/pt/stripe/rdl/lib/rdl/wrap.rb:48:in `foo'
    /Users/pt/stripe/rdl/test/test_typecheck.rb:1674:in `test_to_proc'

@ptarjan ptarjan changed the base branch from master to dev September 15, 2017 21:11
@ptarjan ptarjan changed the title show to_proc bug [issue] show to_proc bug Sep 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant