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

Param typed with Bool doesn't accept :foo-type argument in Rakudo #1288

Closed
p6rt opened this issue Sep 17, 2009 · 6 comments
Closed

Param typed with Bool doesn't accept :foo-type argument in Rakudo #1288

p6rt opened this issue Sep 17, 2009 · 6 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Sep 17, 2009

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

Searchable as RT69200$

@p6rt
Copy link
Author

p6rt commented Sep 17, 2009

From @masak

<masak> rakudo​: sub foo(Bool :$x) {}; foo(​:x)
<p6eval> rakudo 2953ac​: OUTPUT«Parameter type check failed; expected
Bool, but got Int for $x in call to foo
* masak submits rakudobug

This should work, because according to S02, :x is short for x => True.

@p6rt
Copy link
Author

p6rt commented Jun 30, 2010

From @bbkr

On Kiev build

$ perl6 -e 'sub foo(Bool :$x) { say "works!"}; foo(​:x)'
works!

Taken for testing

@p6rt
Copy link
Author

p6rt commented Jun 30, 2010

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

@p6rt
Copy link
Author

p6rt commented Jul 30, 2010

From @bbkr

rechecked on * release, also works.
tests in t/spec/S06-signature/defaults.t

@p6rt
Copy link
Author

p6rt commented Jul 30, 2010

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

@p6rt p6rt closed this as completed Jul 30, 2010
@p6rt
Copy link
Author

p6rt commented Jul 30, 2010

From @kyleha

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

commit cef0417fff18aebc1c6e25c16549e78fe0773aa4
Author​: bbkr <bbkr@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Fri Jul 30 17​:37​:14 2010 +0000

  [t/spec] tests for RT #​69200 Param typed with Bool doesnt accept :foo-type argument in Rakudo
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31875 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S06-signature/defaults.t b/t/spec/S06-signature/defaults.t
index d83d80c..5bd88a5 100644
--- a/t/spec/S06-signature/defaults.t
+++ b/t/spec/S06-signature/defaults.t
@@ -10,7 +10,7 @@ Tests assigning default values to variables of type code in sub definitions.
 
 # L<S06/Optional parameters/Default values can be calculated at run-time>
 
-plan 4;
+plan 5;
 
 sub doubler($x) { return 2 * $x }
 
@@ -41,4 +41,10 @@ ok((MyPack::val_v), "default sub called in package namespace");
     is default_with_list(), 1, 'can have a parcel literal as default value';
 }
 
+# RT #69200
+{
+    sub rt69200(Bool :$x) { $x };
+    is rt69200(:x), True, '":x" is the same as "x => True" in sub call';
+}
+
 # vim: ft=perl6

@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