You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
multi sub trait_mod:<is> (Attribute:D $attr, :$whatever) {
$attr does R;
$attr.thing = 42;
}
class C {
has $.val is whatever;
}
I get this error:
===SORRY!=== Error while compiling /home/autarch/projects/perl6/MetaX-Attribute-LazyBuild/./foo
Cannot modify an immutable Any
at /home/autarch/projects/perl6/MetaX-Attribute-LazyBuild/./foo:13
There are two problems here. One is that the line number is unhelpfully pointing at the line where I declare "has $.val is whatever" and the second is that I'm not being told what exact "immutable Any" can't be modified.
It'd be greatly preferable to get an error like "Cannot set immutable attribute thing on $attr at ...foo:9"
mst++ pointed out that if the problem is with the _user_ of a trait, then reporting the error at the line where the trait is used does make sense. This argues for reporting both lines and/or just including a full call stack.
Migrated from rt.perl.org#127110 (status was 'new')
Searchable as RT127110$
The text was updated successfully, but these errors were encountered: