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

multiple commas in argument list parse as a single comma, should parsefail #103

Closed
p6rt opened this issue May 25, 2008 · 13 comments
Closed

Comments

@p6rt
Copy link

p6rt commented May 25, 2008

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

Searchable as RT54804$

@p6rt
Copy link
Author

p6rt commented May 25, 2008

From @diakopter

whereas perl5 and pugs both give syntax error.

rakudo​: sub foo($v, $w?, $x?, $y?){ say $v~"|"$w"|"$x"|"~$y};
foo(1,,3,); #should say​: 1||3| or syntax error.

gives​: OUTPUT[1|3|||␤]

@p6rt
Copy link
Author

p6rt commented Jun 26, 2009

From @kyleha

I've added a test for this in S06-signature/optional.t

#?rakudo todo 'RT# 54804'
{
  sub rt54804( $v, $w?, $x?, $y? ) {
  (defined( $v ) ?? $v !! 'undef')
  ~ '|' ~
  (defined( $w ) ?? $w !! 'undef')
  ~ '|' ~
  (defined( $x ) ?? $x !! 'undef')
  ~ '|' ~
  (defined( $y ) ?? $y !! 'undef')
  }

  is rt54804( 1, , 3, ), '1|undef|3|undef',
  'two commas parse as if undef is between them';
}

@p6rt
Copy link
Author

p6rt commented Jul 2, 2009

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

@p6rt
Copy link
Author

p6rt commented Jul 18, 2009

From @kyleha

On Sun May 25 10​:55​:44 2008, diakopter.gmail.com wrote​:

foo(1,,3,); #should say​: 1||3| or syntax error.

This should be an error. The test I wrote has changed to an
eval_dies_ok (thanks to lwall++).

@p6rt
Copy link
Author

p6rt commented Dec 4, 2009

From @moritz

The test for this now passes in the ng branch, so the ticket can be
closed as soon as ng replaces master.

@p6rt
Copy link
Author

p6rt commented Mar 7, 2010

From martin@martinkjeldsen.dk

This isn't fixed in ng. It was just a problem with the test (it failed because eval_dies_ok wasn't
able to call sub out of scope)

@p6rt
Copy link
Author

p6rt commented Apr 17, 2010

From @moritz

The correct answer is to parsefail.

@p6rt
Copy link
Author

p6rt commented Jun 29, 2010

From @bbkr

On Sat Apr 17 14​:51​:20 2010, moritz wrote​:

The correct answer is to parsefail.

On Kiev build​:

[16​:23] <bbkr> rakudo​: sub foo($v, $w?, $x?, $y?){ say
$v~"|"$w"|"$x"|"~$y}; foo(1,,3,);
[16​:23] <p6eval> rakudo 1576d4​: OUTPUT«1|3|Any()|Any()␤»

still no parsefail

@p6rt
Copy link
Author

p6rt commented Jul 24, 2010

From oha@oha.it

Signature.pm must be changed before fixing this​:

--- a/src/Perl6/Compiler/Signature.pm
+++ b/src/Perl6/Compiler/Signature.pm
@​@​ -361,7 +361,7 @​@​ method ast($low_level?) {
  my $node := PAST​::Op.new(
  :pasttype('callmethod'),
  :name('new'),
- PAST​::Var.new( :name('Signature'),, :scope('package') ),
+ PAST​::Var.new( :name('Signature'), :scope('package') ),
  PAST​::Var.new( :name($sig_var.name()), :scope
('register'), :named('llsig') )
  );
  if self.bind_target() eq 'lexical' {

@p6rt
Copy link
Author

p6rt commented Oct 14, 2011

From @coke

On Sun May 25 10​:55​:44 2008, diakopter.gmail.com wrote​:

whereas perl5 and pugs both give syntax error.

rakudo​: sub foo($v, $w?, $x?, $y?){ say $v~"|"$w"|"$x"|"~$y};
foo(1,,3,); #should say​: 1||3| or syntax error.

gives​: OUTPUT[1|3|||␤]

Only a minor change in the past year​:

15​:59 < [Coke]> rakudo​: sub foo($v, $w?, $x?, $y?){ say
  $v~"|"$w"|"$x"|"~$y}; foo(1,,3,);
15​:59 <+p6eval> rakudo ce15be​: OUTPUT«Use of uninitialized value in
string
  context␤Use of uninitialized value in string
context␤1|3||␤»

(now it warns on the undefined values)

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented May 29, 2012

From @diakopter

On Fri Oct 14 13​:01​:09 2011, coke wrote​:

On Sun May 25 10​:55​:44 2008, diakopter.gmail.com wrote​:

whereas perl5 and pugs both give syntax error.

rakudo​: sub foo($v, $w?, $x?, $y?){ say $v~"|"$w"|"$x"|"~$y};
foo(1,,3,); #should say​: 1||3| or syntax error.

gives​: OUTPUT[1|3|||␤]

Only a minor change in the past year​:

15​:59 < [Coke]> rakudo​: sub foo($v, $w?, $x?, $y?){ say
$v~"|"$w"|"$x"|"~$y}; foo(1,,3,);
15​:59 <+p6eval> rakudo ce15be​: OUTPUT«Use of uninitialized value in
string
context␤Use of uninitialized value in string
context␤1|3||␤»

(now it warns on the undefined values)

seems fixed. marking testneeded.

16​:57 <diakopter> rakudo​: sub foo($v, $w?, $x?, $y?){ say
$v~"|"$w"|"$x"|"~$y};
  foo(1,,3,);
16​:57 <p6eval> rakudo 024843​: OUTPUT«===SORRY!===␤Preceding context
expects a term, but
  found infix , instead␤at /tmp/QqmCesrQT5​:1␤»

@p6rt
Copy link
Author

p6rt commented May 30, 2012

From @diakopter

On Tue May 29 14​:57​:29 2012, diakopter wrote​:

On Fri Oct 14 13​:01​:09 2011, coke wrote​:

On Sun May 25 10​:55​:44 2008, diakopter.gmail.com wrote​:

whereas perl5 and pugs both give syntax error.

rakudo​: sub foo($v, $w?, $x?, $y?){ say $v~"|"$w"|"$x"|"~$y};
foo(1,,3,); #should say​: 1||3| or syntax error.

gives​: OUTPUT[1|3|||␤]

Only a minor change in the past year​:

15​:59 < [Coke]> rakudo​: sub foo($v, $w?, $x?, $y?){ say
$v~"|"$w"|"$x"|"~$y}; foo(1,,3,);
15​:59 <+p6eval> rakudo ce15be​: OUTPUT«Use of uninitialized value in
string
context␤Use of uninitialized value in string
context␤1|3||␤»

(now it warns on the undefined values)

seems fixed. marking testneeded.

16​:57 <diakopter> rakudo​: sub foo($v, $w?, $x?, $y?){ say
$v~"|"$w"|"$x"|"~$y};
foo(1,,3,);
16​:57 <p6eval> rakudo 024843​: OUTPUT«===SORRY!===␤Preceding context
expects a term, but
found infix , instead␤at /tmp/QqmCesrQT5​:1␤»

test already existed; resolving.

@p6rt
Copy link
Author

p6rt commented May 30, 2012

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

@p6rt p6rt closed this as completed May 30, 2012
@p6rt p6rt added the testneeded label Jan 5, 2020
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