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

Signature of .comb likely too permissive in Rakudo #1040

Closed
p6rt opened this issue Jun 5, 2009 · 7 comments
Closed

Signature of .comb likely too permissive in Rakudo #1040

p6rt opened this issue Jun 5, 2009 · 7 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 5, 2009

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

Searchable as RT66340$

@p6rt
Copy link
Author

p6rt commented Jun 5, 2009

From @masak

<masak> rakudo​: say /foo/ ~~ Regex
<p6eval> rakudo fb2fd4​: OUTPUT«1␤»
<masak> the signature at src/setting/Any-str.pm​:134 still says Code.
should it be Regex instead, like in S32?
<masak> rakudo​: say 'abcdef'.comb({1}).perl
<p6eval> rakudo fb2fd4​: OUTPUT«Method 'to' not found for invocant of
class 'Int'␤»
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Jun 5, 2009

From @masak

On Fri Jun 05 15​:27​:20 2009, masak wrote​:

<masak> rakudo​: say /foo/ ~~ Regex
<p6eval> rakudo fb2fd4​: OUTPUT«1␤»
<masak> the signature at src/setting/Any-str.pm​:134 still says Code.
should it be Regex instead, like in S32?
<masak> rakudo​: say 'abcdef'.comb({1}).perl
<p6eval> rakudo fb2fd4​: OUTPUT«Method 'to' not found for invocant of
class 'Int'␤»
* masak submits rakudobug

Hm, src/builtins/any-str.pir​:647 contains another likely culprit of the
same type...

@p6rt
Copy link
Author

p6rt commented Jun 5, 2009

From [Unknown Contact. See original ticket]

On Fri Jun 05 15​:27​:20 2009, masak wrote​:

<masak> rakudo​: say /foo/ ~~ Regex
<p6eval> rakudo fb2fd4​: OUTPUT«1␤»
<masak> the signature at src/setting/Any-str.pm​:134 still says Code.
should it be Regex instead, like in S32?
<masak> rakudo​: say 'abcdef'.comb({1}).perl
<p6eval> rakudo fb2fd4​: OUTPUT«Method 'to' not found for invocant of
class 'Int'␤»
* masak submits rakudobug

Hm, src/builtins/any-str.pir​:647 contains another likely culprit of the
same type...

@p6rt
Copy link
Author

p6rt commented Jun 5, 2009

@masak - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Nov 4, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S32-str/comb.t

commit 98a4c823e8c9b7c249c0350ea76a373b48e770f6
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Wed Nov 4 22​:46​:09 2009 +0000

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

Inline Patch
diff --git a/t/spec/S32-str/comb.t b/t/spec/S32-str/comb.t
index fffc44e..421b0f5 100644
--- a/t/spec/S32-str/comb.t
+++ b/t/spec/S32-str/comb.t
@@ -2,7 +2,7 @@ use v6;
 
 use Test;
 
-plan 29;
+plan *;
 
 # L<S32::Str/Str/=item comb>
 
@@ -79,5 +79,22 @@ is (<a ab>, <bc ad ba>).comb(m:Perl5/\S*a\S*/), <a ab ad ba>,
     is @l[1].to, 8, '.to of the second item is correct';
 }
 
+# RT #66340
+{
+    my $expected_reason = rx/^'No applicable candidates '/;
+    
+    try { 'RT 66340'.comb( 1 ) };
+    ok $! ~~ Exception, '.comb(1) dies';
+    ok "$!" ~~ $expected_reason, '.comb(1) dies for the expected reason';
+
+    my $calls = 0;
+    try { 'RT 66340'.comb( { $calls++ } ) };
+    #?rakudo 3 todo 'RT 66340'
+    is $calls, 0, 'code passed to .comb is not called';
+    ok $! ~~ Exception, '.comb({...}) dies';
+    ok "$!" ~~ $expected_reason, '.comb({...}) dies for the expected reason';
+}
+
+done_testing;
 
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Mar 9, 2010

From @moritz

works now, tests pass...

@p6rt
Copy link
Author

p6rt commented Mar 9, 2010

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

@p6rt p6rt closed this as completed Mar 9, 2010
@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