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

Typed Array assignment type check fails sometimes #6650

Open
p6rt opened this issue Dec 16, 2017 · 2 comments
Open

Typed Array assignment type check fails sometimes #6650

p6rt opened this issue Dec 16, 2017 · 2 comments

Comments

@p6rt
Copy link

p6rt commented Dec 16, 2017

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

Searchable as RT132592$

@p6rt
Copy link
Author

p6rt commented Dec 16, 2017

From curt@tilmes.org

Under these exact circumstances, I reliably get an error. (Including the
inclusion of the un-neccesary module. If I change anything, it works fine.)

~/testing$ perl6 -v
This is Rakudo Star version 2017.10 built on MoarVM version 2017.10
implementing Perl 6.c.

~/testing$ cat Testit.pm6
class AnotherTestClass
{
  has Str @​.something;
}

~/testing$ cat Testmod.pm6
class MyTestClass
{
  has Array[Str] $.list;
}

~/testing$ cat testit.p6
use Testit;
use Testmod;

MyTestClass.new(list => Array[Str].new('this'));

~/testing$ perl6 -I . testit.p6
Type check failed in assignment to $!list; expected Array[Str] but got
Array[Str].new("this")
  in submethod BUILDALL at /home/ctilmes/testing/Testmod.pm6 (Testmod) line
1
  in block <unit> at testit.p6 line 4

@usev6
Copy link

usev6 commented Oct 8, 2023

This doesn't blow up anymore:

$ mkdir gh6650
$ echo 'class AnotherTestClass { has Str @.something }' >gh6650/Testit.rakumod
$ echo 'class MyTestClass { has Array[Str] $.list }' >gh6650/Testmod.rakumod
$ ./rakudo-m -Igh6650 -e 'use Testit; use Testmod; MyTestClass.new(list => Array[Str].new("this")); say "alive"'
alive
$ ./rakudo-m -Igh6650 -e 'use Testit; use Testmod; say MyTestClass.new(list => Array[Str].new("this")).list'
[this]

Tagging "testneeded".

(Btw, from the error message this could be the same problem reported in #4947.)

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

No branches or pull requests

2 participants