[perl #130748] [BUG] weird error when accessing an attribute from a "where" of another attribute

2018-02-09 Thread Zoffix Znet via RT
On Wed, 08 Feb 2017 17:04:56 -0800, fernandocor...@gmail.com wrote:
> I’m getting a "VMNull type object” error when I try to access an
> attribute from the “where” of another attribute.
> 
> https://irclog.perlgeek.de/perl6/2017-02-09#i_14068796
> 
> 
>  Fernando Corrêa de Oliveira m: class C { has Int $.a =
> 42; has Str $.b where $!a }; say C.new : :b<42> #
> should it die with this error?
> 22:32 C<•camelia> rakudo-moar f85978: OUTPUT«Cannot look up attributes
> in a VMNull type object␤  in block  at  line 1␤␤»
> 22:32 S Fernando Corrêa de Oliveira m: class C { has Int
> $.a = 42; has Str $.b where $!a }; say C.new : :42b
> 22:32 C<•camelia> rakudo-moar f85978: OUTPUT«Type check failed in
> assignment to $!b; expected  but got Int (42)␤  in block 
> at  line 1␤␤»
> 22:33 S Fernando Corrêa de Oliveira m: class C { has Int
> $.a = 42; has Str $.b where $!a }; say C.new.a
> 22:33 C<•camelia> rakudo-moar f85978: OUTPUT«42␤»
>   22:33 → pierrot joined  ↔ pyrimidine popped in  ↔ Ven nipped out
> 22:47 S Fernando Corrêa de Oliveira m: class C { has Int
> $.a = 42; has Str $.b where $!a }; say C.new : :42a
> :42b
> 22:47 C<•camelia> rakudo-moar f85978: OUTPUT«Type check failed in
> assignment to $!b; expected  but got Int (42)␤  in block 
> at  line 1␤␤»
> 22:47 S Fernando Corrêa de Oliveira m: class C { has Int
> $.a = 42; has Int $.b where $!a }; say C.new : :42a
> :42b
> 22:47 C<•camelia> rakudo-moar f85978: OUTPUT«Cannot look up attributes
> in a VMNull type object␤  in block  at  line 1␤␤»


Thank you for the report. This is now fixed. Specifically, it now throws a 
useful error,
saying `self` is now available inside such a `where` clause.

Fix: https://github.com/rakudo/rakudo/commit/1c894e418d
Test: https://github.com/perl6/roast/commit/410a3982c5



[perl #130748] [BUG] weird error when accessing an attribute from a "where" of another attribute

2018-02-09 Thread Zoffix Znet via RT
On Wed, 08 Feb 2017 17:04:56 -0800, fernandocor...@gmail.com wrote:
> I’m getting a "VMNull type object” error when I try to access an
> attribute from the “where” of another attribute.
> 
> https://irclog.perlgeek.de/perl6/2017-02-09#i_14068796
> 
> 
>  Fernando Corrêa de Oliveira m: class C { has Int $.a =
> 42; has Str $.b where $!a }; say C.new : :b<42> #
> should it die with this error?
> 22:32 C<•camelia> rakudo-moar f85978: OUTPUT«Cannot look up attributes
> in a VMNull type object␤  in block  at  line 1␤␤»
> 22:32 S Fernando Corrêa de Oliveira m: class C { has Int
> $.a = 42; has Str $.b where $!a }; say C.new : :42b
> 22:32 C<•camelia> rakudo-moar f85978: OUTPUT«Type check failed in
> assignment to $!b; expected  but got Int (42)␤  in block 
> at  line 1␤␤»
> 22:33 S Fernando Corrêa de Oliveira m: class C { has Int
> $.a = 42; has Str $.b where $!a }; say C.new.a
> 22:33 C<•camelia> rakudo-moar f85978: OUTPUT«42␤»
>   22:33 → pierrot joined  ↔ pyrimidine popped in  ↔ Ven nipped out
> 22:47 S Fernando Corrêa de Oliveira m: class C { has Int
> $.a = 42; has Str $.b where $!a }; say C.new : :42a
> :42b
> 22:47 C<•camelia> rakudo-moar f85978: OUTPUT«Type check failed in
> assignment to $!b; expected  but got Int (42)␤  in block 
> at  line 1␤␤»
> 22:47 S Fernando Corrêa de Oliveira m: class C { has Int
> $.a = 42; has Int $.b where $!a }; say C.new : :42a
> :42b
> 22:47 C<•camelia> rakudo-moar f85978: OUTPUT«Cannot look up attributes
> in a VMNull type object␤  in block  at  line 1␤␤»


Thank you for the report. This is now fixed. Specifically, it now throws a 
useful error,
saying `self` is now available inside such a `where` clause.

Fix: https://github.com/rakudo/rakudo/commit/1c894e418d
Test: https://github.com/perl6/roast/commit/410a3982c5


[perl #130748] [BUG] weird error when accessing an attribute from a "where" of another attribute

2017-02-08 Thread via RT
# New Ticket Created by  fernandocor...@gmail.com 
# Please include the string:  [perl #130748]
# in the subject line of all future correspondence about this issue. 
# https://rt.perl.org/Ticket/Display.html?id=130748 >


I’m getting a "VMNull type object” error when I try to access an attribute from 
the “where” of another attribute.

https://irclog.perlgeek.de/perl6/2017-02-09#i_14068796


 Fernando Corrêa de Oliveira m: class C { has Int $.a = 42; has 
Str $.b where $!a }; say C.new : :b<42> # should it die with 
this error?
22:32 C<•camelia> rakudo-moar f85978: OUTPUT«Cannot look up attributes in a 
VMNull type object␤  in block  at  line 1␤␤»
22:32 S Fernando Corrêa de Oliveira m: class C { has Int $.a = 
42; has Str $.b where $!a }; say C.new : :42b
22:32 C<•camelia> rakudo-moar f85978: OUTPUT«Type check failed in assignment to 
$!b; expected  but got Int (42)␤  in block  at  line 1␤␤»
22:33 S Fernando Corrêa de Oliveira m: class C { has Int $.a = 
42; has Str $.b where $!a }; say C.new.a
22:33 C<•camelia> rakudo-moar f85978: OUTPUT«42␤»
22:33 → pierrot joined  ↔ pyrimidine popped in  ↔ Ven nipped out  
22:47 S Fernando Corrêa de Oliveira m: class C { has Int $.a = 
42; has Str $.b where $!a }; say C.new : :42a :42b
22:47 C<•camelia> rakudo-moar f85978: OUTPUT«Type check failed in assignment to 
$!b; expected  but got Int (42)␤  in block  at  line 1␤␤»
22:47 S Fernando Corrêa de Oliveira m: class C { has Int $.a = 
42; has Int $.b where $!a }; say C.new : :42a :42b
22:47 C<•camelia> rakudo-moar f85978: OUTPUT«Cannot look up attributes in a 
VMNull type object␤  in block  at  line 1␤␤»