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

Bogus error message about not enough positional parameter when role method calls another after a role method delegation in Rakudo #2452

Closed
p6rt opened this issue Jul 24, 2011 · 8 comments

Comments

@p6rt
Copy link

p6rt commented Jul 24, 2011

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

Searchable as RT95514$

@p6rt
Copy link
Author

p6rt commented Jul 24, 2011

From @masak

<masak> rakudo​: role R { method foo { self.bar(42) }; method bar($x) {
say "OH HAI" } }; class C does R { method foo { self.R​::foo } };
C.new.foo
<p6eval> rakudo 922500​: OUTPUT«OH HAI␤»
<masak> rakudo​: role R { method bar($x) {}; method foo { self.bar(42)
} }; class C does R { method foo { self.R​::foo } }; C.new.foo
<p6eval> rakudo 922500​: OUTPUT«Not enough positional parameters
passed; got 1 but expected 2␤ in 'bar' at line 22​:/tmp/N060_2D3In␤ in
'C​::foo' at line 22​:/tmp/N060_2D3In␤ in main program body at line
22​:/tmp/N060_2D3In␤»
* masak submits rakudobug
<masak> only the order of the method declarations in the role differs.
<masak> rakudo​: role R { method bar($x) { say "OH HAI" }; method foo {
self.bar(42) } }; R.new.foo
<p6eval> rakudo 922500​: OUTPUT«OH HAI␤»
<masak> and it seems that, somehow, the role method delegation is
necessary to trigger it.

@p6rt
Copy link
Author

p6rt commented May 28, 2012

From @coke

On Sun Jul 24 07​:11​:16 2011, masak wrote​:

<masak> rakudo​: role R { method foo { self.bar(42) }; method bar($x) {
say "OH HAI" } }; class C does R { method foo { self.R​::foo } };
C.new.foo
<p6eval> rakudo 922500​: OUTPUT«OH HAI␤»
<masak> rakudo​: role R { method bar($x) {}; method foo { self.bar(42)
} }; class C does R { method foo { self.R​::foo } }; C.new.foo
<p6eval> rakudo 922500​: OUTPUT«Not enough positional parameters
passed; got 1 but expected 2␤ in 'bar' at line 22​:/tmp/N060_2D3In␤ in
'C​::foo' at line 22​:/tmp/N060_2D3In␤ in main program body at line
22​:/tmp/N060_2D3In␤»
* masak submits rakudobug
<masak> only the order of the method declarations in the role differs.
<masak> rakudo​: role R { method bar($x) { say "OH HAI" }; method foo {
self.bar(42) } }; R.new.foo
<p6eval> rakudo 922500​: OUTPUT«OH HAI␤»
<masak> and it seems that, somehow, the role method delegation is
necessary to trigger it.

The second variant no longer errors. If you put a say $x in the bar method, it's printed out.

Closable?

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented May 28, 2012

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

@p6rt
Copy link
Author

p6rt commented Aug 5, 2012

From @masak

On Sun May 27 20​:48​:46 2012, coke wrote​:

On Sun Jul 24 07​:11​:16 2011, masak wrote​:

<masak> rakudo​: role R { method foo { self.bar(42) }; method bar($x)
{
say "OH HAI" } }; class C does R { method foo { self.R​::foo } };
C.new.foo
<p6eval> rakudo 922500​: OUTPUT«OH HAI␤»
<masak> rakudo​: role R { method bar($x) {}; method foo {
self.bar(42)
} }; class C does R { method foo { self.R​::foo } }; C.new.foo
<p6eval> rakudo 922500​: OUTPUT«Not enough positional parameters
passed; got 1 but expected 2␤ in 'bar' at line 22​:/tmp/N060_2D3In␤
in
'C​::foo' at line 22​:/tmp/N060_2D3In␤ in main program body at line
22​:/tmp/N060_2D3In␤»
* masak submits rakudobug
<masak> only the order of the method declarations in the role
differs.
<masak> rakudo​: role R { method bar($x) { say "OH HAI" }; method foo
{
self.bar(42) } }; R.new.foo
<p6eval> rakudo 922500​: OUTPUT«OH HAI␤»
<masak> and it seems that, somehow, the role method delegation is
necessary to trigger it.

The second variant no longer errors. If you put a say $x in the bar
method, it's printed out.

<masak> r​: role R { method bar($x) { say $x }; method foo { self.bar(42)
} }; class C does R { method foo { self.R​::foo } }; C.new.foo
<p6eval> rakudo 0eea68​: OUTPUT«42␤»

Confirmed.

Closable?

When it has tests, yes. Marking testneeded.

@p6rt
Copy link
Author

p6rt commented Jan 31, 2014

From @peschwa

Am So 05. Aug 2012, 13​:39​:40, masak schrieb​:

On Sun May 27 20​:48​:46 2012, coke wrote​:

On Sun Jul 24 07​:11​:16 2011, masak wrote​:

<masak> rakudo​: role R { method foo { self.bar(42) }; method bar($x)
{
say "OH HAI" } }; class C does R { method foo { self.R​::foo } };
C.new.foo
<p6eval> rakudo 922500​: OUTPUT«OH HAI␤»
<masak> rakudo​: role R { method bar($x) {}; method foo {
self.bar(42)
} }; class C does R { method foo { self.R​::foo } }; C.new.foo
<p6eval> rakudo 922500​: OUTPUT«Not enough positional parameters
passed; got 1 but expected 2␤ in 'bar' at line 22​:/tmp/N060_2D3In␤
in
'C​::foo' at line 22​:/tmp/N060_2D3In␤ in main program body at line
22​:/tmp/N060_2D3In␤»
* masak submits rakudobug
<masak> only the order of the method declarations in the role
differs.
<masak> rakudo​: role R { method bar($x) { say "OH HAI" }; method foo
{
self.bar(42) } }; R.new.foo
<p6eval> rakudo 922500​: OUTPUT«OH HAI␤»
<masak> and it seems that, somehow, the role method delegation is
necessary to trigger it.

The second variant no longer errors. If you put a say $x in the bar
method, it's printed out.

<masak> r​: role R { method bar($x) { say $x }; method foo { self.bar(42)
} }; class C does R { method foo { self.R​::foo } }; C.new.foo
<p6eval> rakudo 0eea68​: OUTPUT«42␤»

Confirmed.

Closable?

When it has tests, yes. Marking testneeded.

Added test to roast in commit 2162736 as per the example above.

@p6rt
Copy link
Author

p6rt commented Feb 20, 2014

From @coke

test added by peschwa++, closing ticket.

--
Will "Coke" Coleda

1 similar comment
@p6rt
Copy link
Author

p6rt commented Feb 20, 2014

From @coke

test added by peschwa++, closing ticket.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Feb 20, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant