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

attribute from one role used in another via private method gone missing #6045

Open
p6rt opened this issue Feb 1, 2017 · 4 comments
Open

attribute from one role used in another via private method gone missing #6045

p6rt opened this issue Feb 1, 2017 · 4 comments

Comments

@p6rt
Copy link

@p6rt p6rt commented Feb 1, 2017

Migrated from rt.perl.org#130690 (status was 'new')

Searchable as RT130690$

@p6rt
Copy link
Author

@p6rt p6rt commented Feb 1, 2017

From @jdv

See https://gist.github.com/anonymous/1bac642c0a774065bb087dab4e03c694.

Note that the point of using the private method was because the attr is
private in the real code.

Can't repro if​:
* switch the "for (​:k1<v1>)" to "for (1..1)"
* change the foo method to public
* have only one class
* move send-and-store into the classes

Loading

@p6rt
Copy link
Author

@p6rt p6rt commented Feb 1, 2017

From @zoffixznet

Attached is the OP's gist, in case that URL ever stops working...

Loading

@p6rt
Copy link
Author

@p6rt p6rt commented Feb 1, 2017

From @zoffixznet

[jdv@​new-host-2 p6-agent]$ cat t/99-test.t
use v6;

role Agent {
  has Str $.id is required;
  has $.state = {};

  method !foo { $!state }
}

role Agent​::WebSourceAgent {
  method send-and-store { for (​:k1<v1>) { if self!foo { } } }
}

class Agent​::AtomAgent does Agent does Agent​::WebSourceAgent {
  method run { loop { self.send-and-store } }
}

class Agent​::FeedBurnerAgent does Agent does Agent​::WebSourceAgent {
  method run { loop { self.send-and-store } }
}

await map { start {
  CATCH { default { die "E​:{$_.gist}​:E"; exit; } };
  $_ mod 2
  ?? Agent​::AtomAgent.new(​:id("a-$_")).run
  !! Agent​::FeedBurnerAgent.new(​:id("f-$_")).run;
} }, 1..50;

# vim​:ft=perl6
[jdv@​new-host-2 p6-agent]$ time perl6 t/99-test.t
Tried to get the result of a broken Promise
  in block <unit> at t/99-test.t line 22

Original exception​:
  E​:P6opaque​: no such attribute '$!state' in type Agent​::FeedBurnerAgent when trying to get a value
  in method foo at t/99-test.t line 7
  in method send-and-store at t/99-test.t line 11
  in method run at t/99-test.t line 15
  in block at t/99-test.t line 24
  :E
  in block at t/99-test.t line 23
  in method send-and-store at t/99-test.t line 11
  in method run at t/99-test.t line 15
  in block at t/99-test.t line 24

real 0m0.541s
user 0m0.974s
sys 0m0.068s
[jdv@​new-host-2 p6-agent]$ time perl6 t/99-test.t
^C

real 1m13.959s
user 4m51.781s
sys 0m0.195s
[jdv@​new-host-2 p6-agent]$ time perl6 t/99-test.t
^C

real 0m22.663s
user 1m27.439s
sys 0m0.459s
[jdv@​new-host-2 p6-agent]$ time perl6 t/99-test.t
Tried to get the result of a broken Promise
  in block <unit> at t/99-test.t line 22

Original exception​:
  E​:P6opaque​: no such attribute '$!state' in type Agent​::FeedBurnerAgent when trying to get a value
  in method foo at t/99-test.t line 7
  in method send-and-store at t/99-test.t line 11
  in method run at t/99-test.t line 15
  in block at t/99-test.t line 24
  :E
  in block at t/99-test.t line 23
  in method send-and-store at t/99-test.t line 11
  in method run at t/99-test.t line 15
  in block at t/99-test.t line 24

real 0m0.756s
user 0m1.280s
sys 0m0.110s
[jdv@​new-host-2 p6-agent]$ time perl6 t/99-test.t
^C

real 0m19.591s
user 1m15.996s
sys 0m0.464s
[jdv@​new-host-2 p6-agent]$ time perl6 t/99-test.t
Use of uninitialized value $s of type Any in string context.
Methods .^name, .perl, .gist, or .say can be used to stringify it to something meaningful.
  in block at t/99-test.t line 23
Tried to get the result of a broken Promise
  in block <unit> at t/99-test.t line 22

Original exception​:
  E​:P6opaque​: no such attribute '$!state' in type Agent​::FeedBurnerAgent when trying to get a value
  in method foo at t/99-test.t line 7
  in method send-and-store at t/99-test.t line 11
  in method run at t/99-test.t line 15
  in block at t/99-test.t line 24
  :E
  in block at t/99-test.t line 23
  in method send-and-store at t/99-test.t line 11
  in method run at t/99-test.t line 15
  in block at t/99-test.t line 24

real 0m0.692s
user 0m1.159s
sys 0m0.091s
[jdv@​new-host-2 p6-agent]$ time perl6 t/99-test.t
Tried to get the result of a broken Promise
  in block <unit> at t/99-test.t line 22

Original exception​:
  E​:P6opaque​: no such attribute '$!state' in type Agent​::FeedBurnerAgent when trying to get a value
  in method foo at t/99-test.t line 7
  in method send-and-store at t/99-test.t line 11
  in method run at t/99-test.t line 15
  in block at t/99-test.t line 24
  :E
  in block at t/99-test.t line 23
  in method send-and-store at t/99-test.t line 11
  in method run at t/99-test.t line 15
  in block at t/99-test.t line 24

real 0m0.512s
user 0m0.854s
sys 0m0.081s
[jdv@​new-host-2 ~]$ perl6 -v
This is Rakudo version 2016.12-377-g7ddc5f7 built on MoarVM version 2016.12-113-gd1da1ba
implementing Perl 6.c.
[jdv@​new-host-2 ~]$

Loading

@p6rt
Copy link
Author

@p6rt p6rt commented Feb 3, 2017

From @jdv

Note that running under MVM_SPESH_DISABLE=1 seems to elide the bug.

On 2017.02.01 01​:01 pm, perl6 via RT wrote​:

Greetings,

This message has been automatically generated in response to the
creation of a trouble ticket regarding​:
"[BUG] [CONC] attribute from one role used in another via private
method gone missing",
a summary of which appears below.

There is no need to reply to this message right now. Your ticket has
been
assigned an ID of [perl #​130690].

Please include the string​:

     \[perl #&#8203;130690\]

in the subject line of all future correspondence about this issue. To
do so,
you may reply to this message.

                    Thank you,
                    perl6\-bugs\-followup@&#8203;perl\.org

-------------------------------------------------------------------------
See
https://gist.github.com/anonymous/1bac642c0a774065bb087dab4e03c694.

Note that the point of using the private method was because the attr
is
private in the real code.

Can't repro if​:
* switch the "for (​:k1<v1>)" to "for (1..1)"
* change the foo method to public
* have only one class
* move send-and-store into the classes

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant