Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't try to load precomp files after changing the precomp store
In the following sequence:
use Test;
use lib 't/spec';
use Test::Utils;
after the 'use lib' we not only may no longer precompile modules, but also may
not load precompiled modules. That's because the precompiled Test::Utils may
link to a different precompiled version of Test. On loading Test::Utils this
Test module would be loaded and conflict with the already loaded Test.

The moral of the story is: to take most advantage of precompilation, try to set
up your repository chain before starting to load modules.
  • Loading branch information
niner committed Nov 15, 2015
1 parent 7ea3dfa commit 06f21ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/CompUnit/Repository/FileSystem.pm
Expand Up @@ -22,7 +22,7 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C
my $dir-sep := $*SPEC.dir-sep;
my $name = $spec.short-name;
my $id = nqp::sha1($name ~ $*REPO.id);
my $handle = $precomp.load($id);
my $handle = $precomp.may-precomp ?? $precomp.load($id) !! CompUnit::Handle;
my $base := $!prefix.abspath ~ $dir-sep ~ $name.subst(:g, "::", $dir-sep) ~ '.';
my $compunit;

Expand Down

0 comments on commit 06f21ba

Please sign in to comment.