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 Array[Foo]
in module gets confused if Array[Foo]
was already referenced in another precompiled module.
#5350
Comments
From autark@gmail.comThe bug can be reproduced with the following code spread over 3 files: main.pl6 use Zot; Zot.pm6 use XXX; sub zot() returns Array of Numeric is export { XXX.pm6 my Numeric @x; When main.pl6 is run, the following error is reported: $ perl6 --version |
From @smlsConfirmed. I tried to golf it down further, but this is the best I could do: $ echo 'say Array[Int];' > B.pm Which prints: (Array[Int]) (Note: Beside the type check failure, another curious thing is that the `say` is executed twice.) The specific constellation needed to cause the issue, appears to be this: 1) The mainline uses a module module, which performs a type check involving a parameterized type. It's as if we end up with two "instances" of the same parameterized type, and the type check gets confused about which one to check against. |
The RT System itself - Status changed from 'new' to 'open' |
From @smlsUPDATE: $ echo 'no precompilation; say Array[Int];' > B.pm |
From github@zwell.netOn Sun, 29 May 2016 10:28:43 -0700, smls75@gmail.com wrote:
If I'm understanding the code correctly, it looks like that's what's happening. The error is coming from type_check_store() in container.c, and when I modified it to print the name and location of rcd->of and obj, the names were both Array[Int], but the memory locations were different. You can confirm that by changing the test case (and get rid of the exception for now): B.pm: Then execute as before: If you ignore precomp, the output is: So in the context of A.pm, Array[Int].new is being associated with the correct type representation in memory, but (undefined) Array[Int] is not. (By the way, I checked .HOW as well and found that that is not having an extra instance created.) So where are the type objects being created and failing to match with existing type objects? Is this type_object_for() in VMArray.c? |
From github@zwell.netAlso, if you print the .WHICH values during BEGIN, you'll find that they're consistent, so the problem occurs either when compiling A.pm or reading the precompiled data. |
This seems to work nowadays:
And also:
Tagging "testneeded". (Btw, from the error message this could be the same problem reported in #6650.) |
Migrated from rt.perl.org#128287 (status was 'open')
Searchable as RT128287$
The text was updated successfully, but these errors were encountered: