We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b8d4388 commit 1fa9ddfCopy full SHA for 1fa9ddf
S06-traits/is-readonly.t
@@ -1,7 +1,7 @@
1
use v6;
2
use Test;
3
4
-plan 12;
+plan 14;
5
6
# L<S06/"Parameter traits"/"=item is readonly">
7
# should be moved with other subroutine tests?
@@ -54,4 +54,15 @@ plan 12;
54
'dies on assignment to (my $x is readonly)';
55
}
56
57
+# RT #71356
58
+{
59
+ class C {
60
+ has $!attr is readonly = 71356;
61
+ method get-attr() { $!attr }
62
+ method set-attr($val) { $!attr = $val }
63
+ }
64
+ is C.new.get-attr, 71356, 'can read from readonly private attributes';
65
+ dies_ok { my $c = C.new; $c.set-attr: 99; }, 'cannot assign to readonly private attribute'
66
+}
67
+
68
# vim: ft=perl6
0 commit comments