On Thu, 21 Sep 2017 16:27:09 -0700, b...@abrij.org wrote:
> On Sat, 05 Aug 2017 06:28:34 -0700, jan-olof.hen...@bredband.net
> wrote:
> > On Wed, 05 Oct 2016 14:23:57 -0700, c...@zoffix.com wrote:
> > >
> > > This code shows the bug:
> > >
> > > zoffix@leliana:~$ perl6 -e 'm: multi foo ($) {"right" }; multi
> > > foo ($ is rw) {"wrong"}; say foo "42"'
> > > wrong
> > >
> > > And if we turn off the optimizer, we get the right candidate called
> > > (same would happen if we add more complex sub bodies, so possibly
> > > the
> > > sub gets inlined):
> > >
> > > zoffix@leliana:~$ perl6 --optimize=off -e 'm: multi foo ($)
> > > {"right" }; multi foo ($ is rw) {"wrong"}; say foo "42"'
> > > right
> > >
> >
> > It would seem that this bug was fixed with
> > https://github.com/rakudo/rakudo/commit/f8b3469439108fead043bab2bd27bde4bac50dca
> > Test(s) needed
> 
> Tests added with roast commit 63181b3c9.  So resolving.

This bug is still present on the JVM backend (and the test code is passing with 
optimize=1). I'm going to reopen this ticket and tag it with [JVM].

I tried to find the source of the bug and I think it is in 'analyze_dispatch' 
in src/Perl6/Metamodel/BOOTSTRAP.nqp. We only check for literals passing to rw 
parameters if the argument passed is native. I added a similar check for the 
case with a non-native argument and the problem disappeared: 
https://github.com/usev6/rakudo/commit/db077336c5

I'm not sure if that's the right way to fix the problem -- especially given 
that some tests that expect code like '1++' to fail with X::Multi::NoMatch are 
failing now. The new exception is X::TypeCheck::Argument+{X::Comp} -- which 
makes some sense as well.

I'd appreciate some feedback on this topic.

Thanks

Christian

Reply via email to