On Sun, 29 May 2016 10:28:43 -0700, sml...@gmail.com wrote: > 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.
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): A.pm: use B; say "A: "~Array[Int].WHICH; say "A (instance.WHAT): "~Array[Int].new.WHAT.WHICH; B.pm: say "B: "~Array[Int].WHICH; say "B (instance.WHAT): "~Array[Int].new.WHAT.WHICH; Then execute as before: perl6 -I. -e 'use A;' If you ignore precomp, the output is: B: Array[Int]|U132044096 B (instance.WHAT): Array[Int]|U132044096 A: Array[Int]|U132044648 A (instance.WHAT): Array[Int]|U132044096 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?