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

call simple code block with named param unexpectedly produce FixedIntegerArray: index out of bounds! #907

Closed
p6rt opened this issue Apr 19, 2009 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Apr 19, 2009

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

Searchable as RT64844$

@p6rt
Copy link
Author

p6rt commented Apr 19, 2009

From @ilyabelikin

Hi there,
Rakudo 0dfcf497, example​:

my $foo = { "Yay" }; say $foo(1);
Yay
my $foo = { "Yay" }; say $foo(foo => 'bar');
FixedIntegerArray​: index out of bounds!

Ilya

@p6rt
Copy link
Author

p6rt commented Aug 3, 2009

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S02-builtin_data_types/anon_block.t

commit a09001edb5fe490880d97fc8e3e58fa7d18bbdb5
Author​: kyle <kyle@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Mon Aug 3 02​:45​:05 2009 +0000

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

Inline Patch
diff --git a/t/spec/S02-builtin_data_types/anon_block.t b/t/spec/S02-builtin_data_types/anon_block.t
index 3cc0d60..41056ab 100644
--- a/t/spec/S02-builtin_data_types/anon_block.t
+++ b/t/spec/S02-builtin_data_types/anon_block.t
@@ -11,7 +11,7 @@ This covers anonymous blocks and subs, as well as pointy blocks
 
 =end description
 
-plan 31;
+plan 34;
 
 # L<S04/"The Relationship of Blocks and Declarations">
 # L<S06/"Anonymous subroutines">
@@ -30,6 +30,25 @@ my $anon_block = { 1 };
 isa_ok($anon_block, Block);
 is($anon_block(), 1, '{} <anon block> works');
 
+# RT #64844
+{
+    eval '$anon_block( 1 )';
+    #?rakudo todo 'Parrot support for zero-arg subs?'
+    ok $! ~~ Exception, 'too many parameters';
+
+    if $! !~~ Exception {
+        skip 2, q{tests don't work if previous test fails};
+    }
+    else {
+        my $errmsg = ~$!;
+
+        eval '$anon_block( foo => "RT #64844" )';
+        ok $! ~~ Exception, 'too many parameters';
+        #?rakudo todo 'RT #64844'
+        is ~$!, $errmsg, 'same error for named param as positional';
+    }
+}
+
 # L<S06/""Pointy blocks"">
 {
     # pointy subs

@p6rt
Copy link
Author

p6rt commented Aug 3, 2009

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

@p6rt
Copy link
Author

p6rt commented Oct 20, 2009

From @moritz

On Sun Apr 19 04​:31​:22 2009, ihrd wrote​:

Hi there,
Rakudo 0dfcf497, example​:

my $foo = { "Yay" }; say $foo(1);
Yay
my $foo = { "Yay" }; say $foo(foo => 'bar');
FixedIntegerArray​: index out of bounds!

10​:30 <@​moritz_> rakudo​: my $foo = { "Yay" }; say $foo(foo => 'bar');
10​:30 <+p6eval> rakudo 9d76f3​: OUTPUT«Unexpected named parameter 'foo'
  passedâ�¤in Main (file src/gen_setting.pm, line 288)â�¤Â»

I consider this error message sufficiently awesome to close this ticket.

@p6rt
Copy link
Author

p6rt commented Oct 20, 2009

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

@p6rt p6rt closed this as completed Oct 20, 2009
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

No branches or pull requests

1 participant