Skip Menu |
Report information
Id: 126804
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: jns+bc [at] gellyfish.co.uk
Cc:
AdminCc:

Severity: (no value)
Tag: Bug
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [BUG] use of module that defines traits within class scope hides locally defined traits
Download (untitled) / with headers
text/plain 1.1k
Hi, there is, to me anyway, an unexpected change in behaviour between 2015.11-163-g2897239 and 2015.11-347-g47d2daf . If it is expected then I am quite happy to accept that (with the behaviour documented,) but it does look unintended to me. Given TR.pm: module TR { multi sub trait_mod:<is> (Attribute:D $a, :$some-trait!) is export { } } And Foo.pm: class Foo { use TR; multi sub trait_mod:<is> (Attribute $a, :$other-trait) is export { } } Then "tr": use Foo; class Womble { has $.foo is other-trait; } results (in the latter revision): Can't use unknown trait 'is other-trait' in an attribute declaration. at /home/jonathan/devel/perl6/tr:4 expecting any of: rw readonly box_target leading_docs trailing_docs But moving the "use TR;" outside the Foo class block makes the trait from within Foo to be recognised. It works in both ways in the 2015.11-163-g2897239 This does have ecosystem implications (see e.g. https://github.com/tadzik/JSON-Unmarshal/pull/14 ) so if it is actually a conscious change in behaviour (and not an unintended consequence of some other change,) it probably needs to be clearly documented somewhere. Thanks.
Download (untitled) / with headers
text/plain 895b
Just bisected this on rakudo-moar and it appears that: 87288285f6f398ec7cba0900312ced4b580d79ed is the first bad commit commit 87288285f6f398ec7cba0900312ced4b580d79ed Author: Stefan Seifert <nine@detonation.org> Date: Sat Nov 14 10:43:38 2015 +0100 Have Repository::FileSystem automatically precompile files We now precompile loaded modules automatically. However, we cannot do this anymore as soon as we encounter a 'use lib' as this changes the precompilation store used. Consider: use Test; use lib 'foo'; use Test::Util; # which again uses Test Test::Util would be loaded from a different precompilation store that contains a different precompiled version of Test to the one already loaded. :040000 040000 67079ac3caa0dea4eab121fa09edfcd14306559c 48e40ca79a4922c6fa912cfd387235e5ddd6f258 M src Not quite sure where that leaves us.
Download (untitled) / with headers
text/plain 338b
It appears (as suggested by nine on IRC,) that changing the 'tr' to: use Test; use lib '.'; use Foo; class Womble { has $.foo is other-trait; } and running it without a '-I.' gets rid of the error, this would suggest there may have been a pre-existing pre-compilation problem, that got exposed when everything was precompiled again.
Download (untitled) / with headers
text/plain 106b
This is stll present as of Rakudo version 2016.03-110-g5bfc8fb built on MoarVM version 2016.03-104-g10d397


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org