Skip Menu |
Report information
Id: 131610
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: druoso <daniel [at] ruoso.com>
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



To: "rakudobug [...] perl.org" <rakudobug [...] perl.org>
Subject: [BUG] Cannot invoke this object (REPR: Null; VMNull) when doing coercitive type constraint with subset
From: Daniel Ruoso <daniel [...] ruoso.com>
Date: Tue, 20 Jun 2017 17:42:02 +0000
Download (untitled) / with headers
text/plain 177b
> 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

RT-Send-CC: perl6-compiler [...] perl.org
On Tue, 20 Jun 2017 10:42:18 -0700, druoso wrote: Show quoted text
> > 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~$


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org