[perl #116182] [BUG] 's;' wrongly parsed as subroutine call in Rakudo

2014-10-14 Thread Christian Bartolomaeus via RT
I added two tests (for parsing "s;" and "m;") to S02-names-vars/names.t with 
the following commit: https://github.com/perl6/roast/commit/9cafef7ce7


[perl #116182] [BUG] 's;' wrongly parsed as subroutine call in Rakudo

2014-10-14 Thread Christian Bartolomaeus via RT
As I understand this bug report, the problem was this:

 r: sub s () { given 9 { return 0 when $_ %% 3; 1 } }; say s;
 rakudo c8de2e: OUTPUT«0␤»

As the subject says the "s;" was parsed as a subroutine call by Rakudo. Back in 
2012 the bug could have been shown a bit shorter:

$ perl6 -e 'sub s { say 42 }; s;'
42

Now we get:

$ perl6 -e 'sub s { say 42 }; s;'
===SORRY!===
Regex not terminated.
at -e:1
--> sub s { say 42 }; s;⏏

The "s;" is no longer parsed as a subroutine call, instead we get a parsing 
error. That's the correct behaviour -- and also how STD parses the code:

$ viv -c -e 'sub s { say 42 }; s;'
===SORRY!===
Regex not terminated at (eval) line 1 (EOF):
--> sub s { say 42 }; s;⏏
Parse failed

I'll add a test and close the ticket. Please correct me if I misunderstood the 
problem.


[perl #113988] [BUG] Null PMC access when doing .fmt on the return value from .reals

2014-10-14 Thread Carl Mäsak via RT
Christian (>):
> So maybe instead of closing this ticket we should change the subject
> of this ticket to 'LTA error message when .sprintf is called with more
> directives than arguments (numeric)'?

No need to keep it open for that, methinks. There's already 
https://rt.perl.org/Ticket/Display.html?id=122907 ("[BUG] LTA error when 
sprintf %d directive doesn't find a corresponding argument in Rakudo") to cover 
that case.

Resolving ticket.




[perl #115842] [BUG] Comma can't be last in a compilation unit in Rakudo

2014-10-14 Thread Christian Bartolomaeus via RT
I added tests to S04-statements/terminator.t with the following commit: 
https://github.com/perl6/roast/commit/1c4c5355d9


[perl #115566] [BUG] Variables declared in quasi blocks don't work in Rakudo

2014-10-14 Thread Christian Bartolomaeus via RT
Just an update: Parrot no longer segfaults, but Moar does:

$ perl6-m -e 'macro foo { quasi { my $a = "OH HAI"; say $a } }; foo'
Segmentation fault

$ perl6-p -e 'macro foo { quasi { my $a = "OH HAI"; say $a } }; foo'
Cannot assign to an immutable value
  in any  at -e:1
  in block  at -e:1

$ perl6-j -e 'macro foo { quasi { my $a = "OH HAI"; say $a } }; foo'
java.lang.NullPointerException
  in any  at -e:1
  in block  at -e:1


[perl #114456] [BUG] Invocation '()' after sub declaration doesn't parse in Rakudo (but does in STD)

2014-10-14 Thread Christian Bartolomaeus via RT
This works now:

$ perl6-m -e 'say sub { 5 }()'
5

$ perl6-m -e 'sub ($t) { say $t }("arf")'
arf

I added tests to S02-lexical-conventions/sub-block-parsing.t with the following 
commit: https://github.com/perl6/roast/commit/09ff5366a3


[perl #114428] [BUG] Subroutines created using 'sub ::(some_constant)' get the wrong name in Rakudo

2014-10-14 Thread Christian Bartolomaeus via RT
Since this works and is in roast for two years I'm closing the ticket.

$ perl6-m -e 'constant name = "foo"; sub ::(name) () { 42 }; say foo()'
42
$ perl6-m -e 'constant name = "foo"; say (sub ::(name) () { 42 }).name'
foo


[perl #113988] [BUG] Null PMC access when doing .fmt on the return value from .reals

2014-10-14 Thread Christian Bartolomaeus via RT
Since this was all about .sprintf being called with only one argument but two 
directives (also cmp. #106594) and since the Null PMC access error is gone, 
this ticket could be closed IMHO.

On the other hand the error from sprintf doesn't look very awesome in the given 
case:

$ perl6-m -e 'sprintf("%d %d", 3);'
No such method 'item' for invocant of type 'NQPMu'
  in method message at src/gen/m-CORE.setting:13340

$ perl6-p -e 'sprintf("%d %d", 3);'
Type check failed in binding $expected; expected 'Any' but got 'Mu'
  in block  at gen/parrot/CORE.setting:963
  in method BUILDALL at gen/parrot/CORE.setting:946
  in method bless at gen/parrot/CORE.setting:935
  in method new at gen/parrot/CORE.setting:920
  in method new at gen/parrot/CORE.setting:918

$ perl6-j -e 'sprintf("%d %d", 3);'
Type check failed in binding $expected; expected 'Any' but got 'Mu'
  in block  at gen/jvm/CORE.setting:949
  in method BUILDALL at gen/jvm/CORE.setting:932
  in method bless at gen/jvm/CORE.setting:921
  in method new at gen/jvm/CORE.setting:905

The error message looks better for strings (AFAIU that was fixed for ticket 
#106594):

$ /perl6-m -e 'sprintf("%s %s", "foo");'
Too many directives: found 2, but only 1 arguments after the format string

So maybe instead of closing this ticket we should change the subject of this 
ticket to 'LTA error message when .sprintf is called with more directives than 
arguments (numeric)'?


[perl #111734] [BUG] Can't locally redefine True in Rakudo

2014-10-14 Thread Christian Bartolomaeus via RT
Great, redefinition of truth works as expected! I added a test to 
S04-declarations/constant.t with the following commit: 
https://github.com/perl6/roast/commit/c855d94be4


[perl #122973] [BUG] Rakudo can't parse/understand SomeRole[Int]::InnerThing

2014-10-14 Thread Carl Mäsak
# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #122973]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=122973 >


 ven++ found this:
 m: role A[::T] { subset Test of Int }; say A[Int]::Test; #
is this the right way to write this?
 rakudo-moar 8b3e8c: OUTPUT«===SORRY!=== Error while
compiling /tmp/XqDHJFTQEu␤Two terms in a row␤at [...] say
A[Int]⏏::Test
 m: role A[::T] { subset Test of Int }; say A::Test
 rakudo-moar 8b3e8c: OUTPUT«Could not find symbol '&Test' [...]
 intuitively I'd expect A[Int]::Test to work.
 me, too. and ven, too
* masak submits rakudobug


[perl #122972] [BUG] Proto regex with params isn't called correctly (possibly NYI) in Rakudo

2014-10-14 Thread Carl Mäsak
# New Ticket Created by  "Carl Mäsak" 
# Please include the string:  [perl #122972]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=122972 >


 m: grammar Test { token TOP {  }; proto token
Foo(Int) {*}; token Foo:sym(Int $a) { "a" }; token Foo:sym(Int
$a) { "b" } }; say Test.parse("a");
 rakudo-moar 8b3e8c: OUTPUT«Too few positionals passed;
expected 2 arguments but got 1␤  in regex Foo:sym [...]
 ven++ stumbled upon this
* masak submits rakudobug
 that should work, right?
 yes.
 It's very likely to be NYI, I think
 huh
 aren't we using something like that in rakudo's own grammar
all the time?
 A proto regex with params? Could be, but it'd be new to me
 Also, Rakudo doesn't compile Rakudo's grammar. :-)


[perl #92822] [BUG] - $a\ .\ chop bug

2014-10-14 Thread Christian Bartolomaeus via RT
On the note of Pepe Schwarz I'm closing this ticket. (The test is passing and 
it's in t/spectest.data.)

$ perl6-m -e 'my $a = "helloo"; $a = $a\ .\ chop; say $a;'
hello



[perl #88748] [BUG] Rakudo doesn't give a good indication of what's happened when an undeclared type is used in a 'when' clause

2014-10-14 Thread Christian Bartolomaeus via RT
As it was noted recently, Rakudo now gives the same error message as STD.

I added a test to S32-exceptions/misc.t with the following commit: 
https://github.com/perl6/roast/commit/7396503e24 and I'm closing the ticket.