Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot invoke this object (REPR: Null; VMNull) when doing coercitive type constraint with subset #6352

Open
p6rt opened this issue Jun 20, 2017 · 3 comments

Comments

@p6rt
Copy link

p6rt commented Jun 20, 2017

Migrated from rt.perl.org#131610 (status was 'open')

Searchable as RT131610$

@p6rt
Copy link
Author

p6rt commented Jun 20, 2017

From daniel@ruoso.com

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

@p6rt
Copy link
Author

p6rt commented Jun 22, 2017

From @zoffixznet

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~$

@p6rt
Copy link
Author

p6rt commented Jun 22, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt p6rt added the optimizer label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant