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

Type check failure for Array[...] as return value caused by irrelevent inclusion from another compunit #5065

Open
p6rt opened this issue Jan 18, 2016 · 2 comments

Comments

@p6rt
Copy link

p6rt commented Jan 18, 2016

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

Searchable as RT127309$

@p6rt
Copy link
Author

p6rt commented Jan 18, 2016

From siavash.askari.nasr@gmail.com

Sample code with this issue​:
https://gist.github.com/CIAvash/1af6cd0fb167526ba847

Problem occurs when a class which has attributes similar to the return
value is used. And that class does not even need to be directly involved, just being
`use`d is enough. In the code mentioned above that class is class B.

In class A​:
use B;
method make_str returns Array of Str {
  Array[Str].new​: '' xx 3;
}

In class B​:
has Str @​.arr;

It gives this error​: 'Type check failed for return value; expected
Array[Str] but got Array[Str].new("", "", "")'

It works when I remove `use B;`, change Str in `has Str @​.arr` to
something else or change @​.arr to $.arr.

IRC​: http://irclog.perlgeek.de/perl6/2016-01-18#i_11905278

@p6rt
Copy link
Author

p6rt commented Aug 6, 2016

From @zoffixznet

Still present in Rakudo version 2016.07.1-88-g15ee3c3 built on MoarVM version 2016.07-11-g11e02fe

--
Cheers,
ZZ | https://twitter.com/zoffix

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

No branches or pull requests

1 participant