[perl #131145] [JVM] Modes for IO::Handle.open need clarification

2018-03-10 Thread Christian Bartolomaeus via RT
On Sat, 10 Mar 2018 11:40:24 -0800, barto...@gmx.de wrote:
> On Thu, 13 Apr 2017 12:21:57 -0700, barto...@gmx.de wrote:
> > [...]
> > * define that :append and :create always imply "write"
> 
> That was also done by Zoffix++ -- mainly with
> https://github.com/perl6/roast/commit/091931a717

Sorry, that comment wasn't clear. What I meant was, that the different open 
modes were specced in S32-io/open.t with said commit.



[perl #131145] [JVM] Modes for IO::Handle.open need clarification

2018-03-10 Thread Christian Bartolomaeus via RT
On Thu, 13 Apr 2017 12:21:57 -0700, barto...@gmx.de wrote:
> [...]
> * define that :append and :create always imply "write"

That was also done by Zoffix++ -- mainly with 
https://github.com/perl6/roast/commit/091931a717



[perl #130493] [RFC][@LARRY] .sink of class not getting called, but Mu.sink is

2018-03-10 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
I find the behavior surprising. Are there any examples of precedence thinkos
that are caught by this?

Added [RFC][@LARRY] tags, with just a little more information I think we'll be
able to close. Maybe.

On 2017-01-03 09:00:06, jn...@jnthn.net wrote:
> On Tue, 03 Jan 2017 04:54:52 -0800, elizabeth wrote:
> > $ 6 'class A { method sink() { say "goodbye" } }; A’
> > WARNINGS for -e:
> > Useless use of constant value A in sink context (line 1)
> >
> > I would expected this to say “goodbye” rather than being silent and
> > issuing a warning. The fact that a class has a specific .sink method
> > indicates that the developer had a plan for functioning in a sink
> > environment. So it should a. call that method and b. not issue a
> > warning.
> >
> I think we consciously decided that use of a type object in sink
> context would always warn (justification is that it's been known to
> catch the odd precedence thinko). Note that with an instance:
>
> $ perl6-m 'class A { method sink() { say "goodbye" } }; A.new'
> goodbye
>
> It does exactly what you expect.
>
> /jnthn



[perl #130616] Wrong source line number reported for misspelled private class attribute names

2018-03-10 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
Still reproducible:

 6c: class Foo {␤ method foo {␤ say $!bad;␤ }␤ }␤
 AlexDaniel, ¦6c (28 commits): «===SORRY!=== Error while
compiling /tmp/Qj1o8IL3bG␤Attribute $!bad not declared in class Foo␤at
/tmp/Qj1o8IL3bG:6␤--> ⏏␤ «exit code = 1»»

On 2017-01-21 16:47:53, agen...@gmail.com wrote:
> Hi there
>
> I've just noted that Rakudo 2017.01 reports the wrong line number for
> any references of misspelled private class attributes. The minimal
> example to reproduce this is as follows:
>
> class Foo {
> method foo {
> say $!bad;
> }
> }
>
> Foo.foo();
>
> Rakudo reports the following:
>
> ===SORRY!=== Error while compiling /home/agentzh/a.p6
> Attribute $!bad not declared in class Foo
> at /home/agentzh/a.p6:7
> --> }⏏
>
> Note the line number is 7 while the offending line is at line 3. It
> seems that rakudo always reports the last line of the containing
> source file, which is never useful.
>
> I haven't tested any other Rakudo releases yet. So I'm not sure if
> it's a long standing issue or just a recent regression.
>
> Thanks for your attention!
>
> Best regards,
> -agentzh



[perl #126014] Too many repetitions with xx operator causes out of memory; should it work lazily?

2018-03-10 Thread Jan-Olof Hendig via RT
On Wed, 22 Feb 2017 03:59:05 -0800, elizabeth wrote:
> > On 22 Feb 2017, at 12:41, jn...@jnthn.net via RT  > follo...@perl.org> wrote:
> > On Sat, 30 Apr 2016 03:42:00 -0700, alex.jakime...@gmail.com wrote:
> >> OK, I said that it only segfaults on 32-bit systems, but I was
> >> wrong.
> >>
> >> Code:
> >> 42 xx (2 ** 62)
> >>
> >> Result:
> >> Segmentation fault
> >>
> > This is patched in MoarVM HEAD just now and no longer SEGVs (reports
> > the array is too long to allocate). So, no longer a SEGV bug.
> >
> > However, I'm a bit surprised that xx does not work lazily, and
> > actually makes such a huge array up-front. Not sure if we want to re-
> > purpose the ticket for that; I'll remove the SEGV from the title,
> > however, since that is resolved.
> 
> Ah, yes, I remember we discussed this.  I’ll make it a Seq, although
> the question then becomes: should it be lazy or not?  If it is not
> lazy, we would just be postponing the exception in some cases.
> 
> 
> Liz

Fixed with commit 
https://github.com/rakudo/rakudo/commit/1eb7b1f796214870b53c7ed055907cb29076dc78
 



[perl #131206] “Oops!!!” when using --target=ast (^…)

2018-03-10 Thread Jan-Olof Hendig via RT
On Mon, 24 Apr 2017 15:32:33 -0700, alex.jakime...@gmail.com wrote:
> Run this:
> perl6 --target=ast -e '^…'
> 
> And among normal lines from the output you will see these messages:
> 
> Oops!!! Cannot invoke this object (REPR: P6opaque; NQPMu)
> 
> I don't think it should happen.
> 
> 
> Full output here:
> 
> - QAST::CompUnit  :W :UNIT
>   [pre_deserialize]
>  - QAST::Stmt
>- QAST::Stmt
>  - QAST::Op(loadbytecode)
>- QAST::VM
> [jvm]
>- QAST::SVal(ModuleLoader.class)
> [moar]
>- QAST::SVal(ModuleLoader.moarvm)
>  - QAST::Op(callmethod load_module)
>- QAST::Op(gethllsym)
>  - QAST::SVal(nqp)
>  - QAST::SVal(ModuleLoader)
>- QAST::SVal(Perl6::ModuleLoader)
>- QAST::Op(forceouterctx)
>  - QAST::BVal(2)
>  - QAST::Op(callmethod load_setting)
>- QAST::Op(getcurhllsym)
>  - QAST::SVal(ModuleLoader)
>- QAST::SVal(CORE)
>   [post_deserialize]
>  - QAST::Stmts
>- QAST::Op(bind)
>  - QAST::Var(attribute $!do)
>- QAST::WVal(Block)
>- QAST::WVal(Code)
>  - QAST::BVal(1)
>  - QAST::Op(bindcurhllsym)
>- QAST::SVal(GLOBAL)
>- QAST::WVal(GLOBAL)
>   [load]
>  - QAST::Op(call)
>- QAST::BVal(2)
>   [children]
> - QAST::Block  :in_stmt_mod ^…
>- QAST::Var(local __args__ :decl(param))
> - QAST::Stmts
>- QAST::Op(call)
> - QAST::Block(:blocktype(declaration_static))
> :IN_DECL :in_stmt_mod :code_object :outer
> - QAST::Stmts
>  - QAST::Var(lexical $¢ :decl(contvar))
>  - QAST::Var(lexical $! :decl(contvar))
>  - QAST::Var(lexical $/ :decl(contvar))
>  - QAST::Var(lexical $_ :decl(contvar))
>  - QAST::Var(lexical GLOBALish :decl(static))
>  - QAST::Var(lexical EXPORT :decl(static))
>  - QAST::Var(lexical $?PACKAGE :decl(static))
>  - QAST::Var(lexical ::?PACKAGE :decl(static))
>  - QAST::Var(lexical $=finish :decl(static))
>  - QAST::Var(lexical $=pod :decl(static))
>   [value]
>  -
>  - QAST::Var(lexical !UNIT_MARKER :decl(static))
>- QAST::VM
> [jvm]
>- QAST::Op(null)
> [moar]
>- QAST::Op(null)
> [loadlibs]
>   - nqp_group nqp_ops perl6_ops bit_ops math_ops trans_ops
> io_ops obscure_ops os file sys_ops nqp_bigint_ops nqp_dyncall_ops
>- QAST::Stmts
>  - QAST::Op(bind)
>- QAST::Var(local ctxsave :decl(var))
>- QAST::Var(contextual $*CTXSAVE)
>  - QAST::Op(unless)
>- QAST::Op(isnull)
>  - QAST::Var(local ctxsave)
>- QAST::Op(if)
>  - QAST::Op(can)
>- QAST::Var(local ctxsave)
>- QAST::SVal(ctxsave)
>  - QAST::Op(callmethod ctxsave)
>- QAST::Var(local ctxsave)
>- QAST::Stmts
>  - QAST::WVal(Array)
> - QAST::Stmts  ^…
>   - QAST::Stmt  ^…
> - QAST::Want 
>   - QAST::Op(call :<^>)  :statement_id
> ^
> - QAST::Op(call )  …
>   - QAST::Op(callmethod new) 
> - QAST::WVal(X::StubCode) 
> Oops!!! Cannot invoke this object (REPR: P6opaque; NQPMu)
>   - v
>- QAST::Op(p6sink)
> - QAST::Op(call :<^>) 
> :statement_id ^
>   - QAST::Op(call )  …
> - QAST::Op(callmethod new) 
>   - QAST::WVal(X::StubCode) 
> Oops!!! Cannot invoke this object (REPR: P6opaque; NQPMu)
>  - QAST::WVal(Nil)

Fixed with commit 
https://github.com/rakudo/rakudo/commit/49dce163e8182ee726cd1e512a03c29551cc16da

Found by bisectbot++ using:
bisect: my $p = run :out, ; say 
$p.out.slurp-rest.contains: ‘Oops’ 

Tests should not be added to roast, rather 
https://github.com/rakudo/rakudo/tree/master/t



[perl #127869] [BUG] if my $match is True and False

2018-03-10 Thread Jan-Olof Hendig via RT
On Sun, 18 Dec 2016 15:36:31 -0800, c...@zoffix.com wrote:
> On Sun, 10 Apr 2016 07:56:38 -0700, mar...@senfdax.de wrote:
> > Hi there,
> >
> > following code dies in this line:
> >
> > if my $match = $r.match($meth, $uri) { die "What?!" unless $match }
> >
> > this happens on both moar-2015.12 and moar-2016.03
> >
> >
> >
> >
> >
> > class Abc {
> > has Str $.method;
> > has Regex $.path is required;
> >
> > method match (Str $method, Str $path) {
> > return False if $.method ne $method;
> > return $path ~~ $.path;
> > }
> > }
> >
> > my @routes = (
> > Abc.new(method => "GET", path => / ^ '/'foo $ / );
> > Abc.new(method => "POST", path => / ^ '/'bar $ /);
> > );
> >
> > sub foo($meth, $uri) {
> > for @routes -> $r {
> > if my $match = $r.match($meth, $uri) { die "What?!" unless
> > $match }
> > }
> > }
> >
> > my @hex = ('A'..'F', 'a'..'f', 0..9).flat;
> > for @hex -> $first {
> > for @hex -> $second {
> > foo("POST", 'http://127.0.0.1/utf8');
> > }
> > }
> >
> 
> Unable to reproduce this on This is Rakudo version 2016.12-10-g7a642f8
> built on MoarVM version 2016.12
> implementing Perl 6.c.

Fixed with commit 
https://github.com/rakudo/rakudo/commit/25e9fd76e85fabda20e263b6f87e27b0673f26e2

For reference:
https://github.com/perl6/nqp/compare/2016.07-140-g2df0a06...2016.07-177-gb416158
https://github.com/MoarVM/MoarVM/compare/2016.07-17-g40948f6...2016.07-24-g31eccd7



[perl #130843] [MOAR][IO] .seek(... SeekFromCurrent) seeks to incorrect place if called after .readchars

2018-03-10 Thread Jan-Olof Hendig via RT
On Wed, 22 Feb 2017 15:09:44 -0800, c...@zoffix.com wrote:
> If .seek(... SeekFromCurrent) is called after a call to .readchars,
> the position sought to appears to be way off target:
> 
> 22:54   IOninja m: "/tmp/Foo.pm6".IO.spurt: "I love you so very
> much"; with "/tmp/Foo.pm6".IO.open { .read(2); .seek: 1,
> SeekFromCurrent; .tell.say }
> 22:54   camelia rakudo-moar 5ec251: OUTPUT: «3␤»
> 22:55   IOninja m: "/tmp/Foo.pm6".IO.spurt: "I love you so very
> much"; with "/tmp/Foo.pm6".IO.open { .readchars(2); .seek: 1,
> SeekFromCurrent; .tell.say }
> 22:55   camelia rakudo-moar 5ec251: OUTPUT: «24␤»
> 22:55   IOninja looks .readchars messes up the current position as
> far as seekage is concerned (it's fine if you try to read more, for
> example)
> 
> After some discussion on IRC (https://irclog.perlgeek.de/perl6-
> dev/2017-02-22 ), one suggestion was that there's some sort of
> buffering involved:
> 
> 23:00   m: "/tmp/Foo.pm6".IO.spurt: "I love you\nso very
> much"; with "/tmp/Foo.pm6".IO.open { .readchars(2); .seek: 1,
> SeekFromCurrent; .tell.say }
> 23:00   camelia rakudo-moar 5ec251: OUTPUT: «24␤»
> 23:00   IOninja m: "/tmp/Foo.pm6".IO.spurt: "I love you\nso very
> much" x 100; with "/tmp/Foo.pm6".IO.open { .readchars(2); .seek: 1,
> SeekFromCurrent; .tell.say }
> 23:00   camelia rakudo-moar 5ec251: OUTPUT: «2301␤»
> 23:00   jnthn   Anyway, just sayin' that if it's off-by-one it's
> actually not lying :)
> 23:00   IOninja m: "/tmp/Foo.pm6".IO.spurt: "I love you\nso very
> much" x 1; with "/tmp/Foo.pm6".IO.open { .readchars(2); .seek: 1,
> SeekFromCurrent; .tell.say }
> 23:00   camelia rakudo-moar 5ec251: OUTPUT: «32769␤»
> 23:00   IOninja m: "/tmp/Foo.pm6".IO.spurt: "I love you\nso very
> much" x 2; with "/tmp/Foo.pm6".IO.open { .readchars(2); .seek: 1,
> SeekFromCurrent; .tell.say }
> 23:00   camelia rakudo-moar 5ec251: OUTPUT: «32769␤»
> 
> This behaviour is not present on JVM.

The fixes, and tests, made by Zoffix, when fixing 
https://rt.perl.org/Public/Bug/Display.html?id=131376
covers this bug as well.



[perl #130941] infix: keeps containers around since October, resulting in confusing behaviour

2018-03-10 Thread Aleks-Daniel Jakimenko-Aleksejev via RT
This ticket now needs tests, further discussion related issues here:
https://github.com/rakudo/rakudo/issues/1607

On 2017-03-08 05:56:13, c...@zoffix.com wrote:
> A temporary fix has been committed in
>
https://github.com/rakudo/rakudo/commit/5b7b7fb5c942a3e74097b5eb94a22be262f74c9f



[perl #131145] Modes for IO::Handle.open need clarification

2018-03-10 Thread Christian Bartolomaeus via RT
On Thu, 13 Apr 2017 12:21:57 -0700, barto...@gmx.de wrote:
> [...]
> * expand the documentation of "open"

That was done by Zoffix++ with https://github.com/perl6/doc/commit/ca2a3a0bfb



[perl #131275] Str.comb returns a List instead of a Seq when matcher is a Regex

2018-03-10 Thread Jan-Olof Hendig via RT
On Sat, 10 Mar 2018 10:34:05 -0800, jan-olof.hen...@bredband.net wrote:
> On Mon, 08 May 2017 15:01:03 -0700, c...@zoffix.com wrote:
> > Filing per https://irclog.perlgeek.de/perl6-dev/2017-05-08#i_14551843
> > 
> >  m: say WHAT 'foo'.comb
> >  rakudo-moar 20cfd6: OUTPUT: «(Seq)␤»
> >  m: say WHAT 'foo'.comb: 1
> >  rakudo-moar 20cfd6: OUTPUT: «(Seq)␤»
> >  m: say WHAT 'foo'.comb: /1/
> >  rakudo-moar 20cfd6: OUTPUT: «(List)␤»
> > 
> > See also https://irclog.perlgeek.de/perl6-dev/2017-05-08#i_14552322
> 
> Dupe of G #1564

Full link: https://github.com/rakudo/rakudo/issues/1564



[perl #131275] Str.comb returns a List instead of a Seq when matcher is a Regex

2018-03-10 Thread Jan-Olof Hendig via RT
On Mon, 08 May 2017 15:01:03 -0700, c...@zoffix.com wrote:
> Filing per https://irclog.perlgeek.de/perl6-dev/2017-05-08#i_14551843
> 
>  m: say WHAT 'foo'.comb
>  rakudo-moar 20cfd6: OUTPUT: «(Seq)␤»
>  m: say WHAT 'foo'.comb: 1
>  rakudo-moar 20cfd6: OUTPUT: «(Seq)␤»
>  m: say WHAT 'foo'.comb: /1/
>  rakudo-moar 20cfd6: OUTPUT: «(List)␤»
> 
> See also https://irclog.perlgeek.de/perl6-dev/2017-05-08#i_14552322

Dupe of G #1564



[perl #126563] [BUG] 'X' meta-operator fails with RHS input from parenthesized output of another 'X'

2018-03-10 Thread Jan-Olof Hendig via RT
On Thu, 08 Mar 2018 09:52:50 -0800, jan-olof.hen...@bredband.net wrote:
> On Wed, 04 Nov 2015 12:43:18 -0800, dhoek...@gmail.com wrote:
> > In perl6 version 2015.10-158-gbccb16d built on MoarVM version
> > 2015.10-46-g5bf7e46:
> >
> > Looking at the code for Hamming numbers at Rosetta Code found this
> > problem:
> >
> > my @z = <1 2>;
> > say  @z X*  @z  X* @z;# OK
> > say (@z X*  @z) X* @z;# OK
> > say  @z X* (@z  X* @z).Array; # OK
> > say  @z X* (@z  X* @z);  # fails
> >
> > (1 2 2 4 2 4 4 8)
> > (1 2 2 4 2 4 4 8)
> > (1 2 2 4 2 4 4 8)
> > ===SORRY!===
> > Cannot invoke this object (REPR: Uninstantiable)
> >
> > Likewise fails for other arithmetic operations (+, -, /, **), as well
> > as:
> >
> > my @y = ;
> > say  @y X~ (@y  X~ @y);  # fails
> >
> > But ','  works with both @x and @y.
> 
> This was fixed with commit a26f51361bfea213fa59749d7a401e09c8f2ef31.
> Tests needed.

Tests added with roast commit https://github.com/perl6/roast/commit/b68073aa15



[perl #126702] [JVM] failing test in S06-multi/subsignature.t: wrong multi candidate called when slurpy and named are passed

2018-03-10 Thread Christian Bartolomaeus via RT
On Sat, 27 Jan 2018 17:19:18 -0800, pesc...@gmail.com wrote:
> On Sat, 21 Nov 2015 06:12:07 -0800, barto...@gmx.de wrote:
> > The following code does not give the expected result ('2') on
> > rakudo.jvm:
> >
> > $ perl6-j -e 'multi catch(| (*@all ) ) { 1 }; multi catch(| (*@all,
> > :$really! ) ) { 2 }; say catch(0, 5, :!really)'
> > 1
> 
> 
> Neither the mentioned test file nor the specific code example seem to
> fail on current Rakudo as well as the currently availabe camelia build
> (which is a92950fb4). With confirmation I'd request closing this
> ticket, as it refers to existing tests that used to fail but don't
> anymore.

rakudo-j is still wrong (also tested with current HEAD (26522e8acd)):

  r: multi catch(| (*@all ) ) { 1 }; multi catch(| (*@all, 
:$really! ) ) { 2 }; say catch(0, 5, :!really)
   rakudo-moar 65874b155: OUTPUT: «2␤»
   ..rakudo-jvm a92950fb4: OUTPUT: «1␤»

The test in S06-multi/subsignature.t is fudged todo, that's why the testfile 
passes. Maybe this comment was meant for a different ticket?


[perl #130502] [LTA] error message complains too much about Metamodel.nqp (Buf.new('0'))

2018-03-10 Thread Jan-Olof Hendig via RT
On Wed, 04 Jan 2017 14:21:15 -0800, alex.jakime...@gmail.com wrote:
> Code:
> say Buf.new('0')
> 
> Result:
> Type check failed in initializing element #0 to Buf; expected uint8
> but got Str ("0")
>   in any  at gen/moar/Metamodel.nqp line 1727
>   in block  at /tmp/9PmeQTevmg line 1
> 
> Actually thrown at:
>   in any  at gen/moar/Metamodel.nqp line 3072
>   in any  at gen/moar/Metamodel.nqp line 1727
> in block  at /tmp/9PmeQTevmg line 1
> 
> 

Fixed with commit 
https://github.com/rakudo/rakudo/commit/f230224d27bb6d47746de836113b07bf9a4ebcc0
> 
> It points three times to a line in Metamodel.nqp, and only once to the
> actual user file. Perhaps there is a way to improve it? Maybe not just
> for this case, but for any exception?