On Tue, 20 Jun 2017 10:42:18 -0700, druoso wrote:
> > subset StrToInt of Str where +*; multi foo(Int(StrToInt) $f) { say $f };
> foo("42");
> Cannot invoke this object (REPR: Null; VMNull)
> in whatevercode at <unknown file> line 1
Looks to be an optimizer bug:
zoffix@VirtualBox~$ perl6 -e 'm: subset StrToInt of Str where {dd .Numeric;
.Numeric}; multi foo(Int(StrToInt) $f) { say $f }; foo("42");'
Use of uninitialized value of type Str in numeric context
in block at -e line 1
0
Use of uninitialized value of type Str in numeric context
in block at -e line 1
42
42
42
zoffix@VirtualBox~$ perl6 --optimize=off -e 'm: subset StrToInt of Str where
{dd .Numeric; .Numeric}; multi foo(Int(StrToInt) $f) { say $f }; foo("42");'
42
42
42
zoffix@VirtualBox~$ perl6 -e 'm: subset StrToInt of Str where {dd .Numeric;
.Numeric}; sub foo(Int(StrToInt) $f) { say $f }; foo("42");'
42
42
zoffix@VirtualBox~$