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

where clause in attributes doesn't get thunked right when is default is used #1465

Closed
zoffixznet opened this issue Feb 1, 2018 · 2 comments

Comments

@zoffixznet
Copy link
Contributor

<Zoffix__> m: class { has $.z is default(1) where * == 0 }.new.z.say
<camelia> rakudo-moar 72948e847: OUTPUT: «===SORRY!=== Error while compiling <tmp>␤Cannot invoke this object (REPR: Null; VMNull)␤at <tmp>:1␤»


<Zoffix__> m: class { has $.z is default(1) where {$_ > 0} }.new.z.say
<camelia> rakudo-moar 72948e847: OUTPUT: «1␤»
<Zoffix__> m: class { has $.z is default(1) where *.so }.new.z.say
<camelia> rakudo-moar 72948e847: OUTPUT: «1␤»
<Zoffix__> m: class { has $.z where * == 0 }.new.z.say
<camelia> rakudo-moar 72948e847: OUTPUT: «(<anon>)␤»
zoffixznet added a commit that referenced this issue Feb 1, 2018
Phixes #1465

When we compile_in_context, we rake the .ann('outer')s to find all
the good bits. However, Whatever curries don't get that annotation
and so the raking stops prematurely. This causes any curry that
tries to access some core symbols (like subroutines) executed
during being time explode.

Fix by adding annotation of setting the outer to the current pad.
@ZzZombo
Copy link

ZzZombo commented Feb 2, 2018

Is also busted for junctions, if I read it right, only WhateverCode was fixed.

@zoffixznet
Copy link
Contributor Author

Yup.

<Zoffix__> m: class { has $.z is default(1) where 1|2 }.new.z.say
<camelia> rakudo-moar 4507a5654: OUTPUT: «===SORRY!=== Error while compiling <tmp>␤Cannot invoke this object (REPR: Null; VMNull)␤at <tmp>:1␤»

@zoffixznet zoffixznet reopened this Feb 2, 2018
zoffixznet added a commit that referenced this issue Feb 2, 2018
Phixes #1465

When we compile_in_context, we rake the .ann('outer')s to find all
the good bits. However, the `where` thunks don't get that annotation
and so the raking stops prematurely. This causes the thunk that
tries to access some core symbols (like Junction ops) executed
during being time explode.

Fix by adding annotating the thunk with the current pad.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants