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

'Callable &x' in a signature doesn't mean what Rakudo thinks it means #1231

Closed
p6rt opened this issue Aug 16, 2009 · 5 comments
Closed

'Callable &x' in a signature doesn't mean what Rakudo thinks it means #1231

p6rt opened this issue Aug 16, 2009 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Aug 16, 2009

Migrated from rt.perl.org#68578 (status was 'resolved')

Searchable as RT68578$

@p6rt
Copy link
Author

p6rt commented Aug 16, 2009

From @masak

<jnthn> rakudo​: sub foo( &x) { say "ok" }; foo({ say "lol" })
<p6eval> rakudo 0d4fe0​: OUTPUT«ok␤»
<jnthn> rakudo​: sub foo(Callable &x) { say "ok" }; foo({ say "lol" })
<p6eval> rakudo 0d4fe0​: OUTPUT«ok␤»
<jnthn> wtf
<jnthn> rakudo​: sub foo(&x) { }; say &foo.signature.perl;
<p6eval> rakudo 0d4fe0​: OUTPUT«​:(x)␤»
<masak> something wrong?
<jnthn> rakudo​: sub foo(Callable &x) { }; say &foo.signature.perl;
<p6eval> rakudo 0d4fe0​: OUTPUT«​:(x where all(Callable))␤»
<jnthn> :-/
<masak> please state the nature of your medical emergency.
<jnthn> masak​: Callable &x should mean I can only pass something that
does Callable[Callable]
* masak submits rakudobug
<jnthn> Damm, just when I think I've got something right.
<wolverian> is the type parameter the return type?
<jnthn> The type parameter indicates the return type constraint.

@p6rt
Copy link
Author

p6rt commented Oct 9, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S06-signature/code.t

commit 7b90df932029168b1169472c623a5f015c91e54b
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Fri Oct 9 17​:14​:06 2009 +0000

  [t/spec] Test for RT #​68578
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;28679 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S06-signature/code.t b/t/spec/S06-signature/code.t
index 2ff20ee..26f8660 100644
--- a/t/spec/S06-signature/code.t
+++ b/t/spec/S06-signature/code.t
@@ -1,6 +1,6 @@
 use v6;
 use Test;
-plan 4;
+plan 6;
 
 # TODO: move this test to closure-parameters.t if it works in the future
 
@@ -28,4 +28,12 @@ sub not_returns_a_sub { 3 };
 dies_ok {tester2(not_returns_a_sub)}, 
         "can't pass thing that doesn't do Callable";
 
+is tester2({ 'block' }), 1, 'Can pass a block to a &parameter';
+
+# RT #68578
+{
+    sub rt68578( Callable &x ) {}
+    dies_ok { rt68578({ 'block' }) }, "Can't pass block that doesn't do Callable";
+}
+
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Oct 9, 2009

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 9, 2009

From @kyleha

The new tests for this pass, so I'm marking this resolved.

@p6rt
Copy link
Author

p6rt commented Oct 9, 2009

@kyleha - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Oct 9, 2009
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant