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
Lexical subs aren't found during attribute initialization in Rakudo #1674
Comments
From @masak<masak> rakudo: class A { sub b { 0x10 }; has $!c = b }; A.new |
From @masak<masak> rakudo: class A { sub b { 0x10 }; has $!c = b }; A.new Calling &b from the class scope in general works fine, but not in the |
From @jnthnOn Fri Apr 09 09:14:07 2010, masak wrote:
Unf'up'd now.
Given to moritz++ for spectesting. Thanks, Jonathan |
The RT System itself - Status changed from 'new' to 'open' |
@moritz - Status changed from 'open' to 'resolved' |
From @kylehaThis is an automatically generated mail to inform you that tests are now available in t/spec/S12-attributes/instance.t commit 8a69002619251c8f4b03425e40a01e4b0483ee1a [t/spec] tests for RT #74186, unfudge two similar tests, and switch to planless testing Inline Patchdiff --git a/t/spec/S12-attributes/instance.t b/t/spec/S12-attributes/instance.t
index 27c6d9b..0f49b1f 100644
--- a/t/spec/S12-attributes/instance.t
+++ b/t/spec/S12-attributes/instance.t
@@ -2,7 +2,7 @@ use v6;
use Test;
-plan 129;
+plan *;
=begin pod
@@ -26,7 +26,7 @@ class Foo1 { has $.bar; };
}, '.. checking autogenerated accessor existence';
ok($val, '... $foo.can("bar") should have returned true');
ok($foo.bar().notdef, '.. autogenerated accessor works');
- ok($foo.bar.notdef, '.. autogenerated accessor works w/out parens');
+ ok($foo.bar.notdef, '.. autogenerated accessor works w/out parens');
}
# L<S12/Attributes/Pseudo-assignment to an attribute declaration specifies the default>
@@ -187,7 +187,6 @@ class Foo1 { has $.bar; };
class Foo7e { has $.attr = 42 }
is Foo7e.new.attr, 42, "default attribute value (1)";
-#?rakudo todo 'scoping issues'
{
my $was_in_supplier = 0;
sub forty_two_supplier() { $was_in_supplier++; 42 }
@@ -576,4 +575,19 @@ is Foo7e.new.attr, 42, "default attribute value (1)";
}
+# RT #74186
+{
+ sub outer { 42 };
+ class AttribLex {
+ sub inner { 23 };
+ has $.outer = outer();
+ has $.inner = inner();
+ }
+ is AttribLex.new.outer, 42, 'Can use outer lexicals in attribut initialization';
+ is AttribLex.new.inner, 23, 'Can use lexicals in attribut initialization';
+
+}
+
+done_testing();
+
# vim: ft=perl6 |
From @cokeOn Tue May 25 06:41:53 2010, masak wrote:
This no longer dies; Does it do what you want, though? -- |
The RT System itself - Status changed from 'new' to 'open' |
From @masakmasak (>>), coke (>):
Seems it does. <masak> rakudo: class A { sub b { 0x10 }; has Taking to tests. |
Migrated from rt.perl.org#74186 (status was 'resolved')
Searchable as RT74186$
The text was updated successfully, but these errors were encountered: