Dear Raku experts

I have a little patch which adds another library include path and installation 
site named "foo" which points to "/opt/foo/lib", see attached patch.

That worked (in a similar fashion) well with 2020.02, but with 2020.05 it fails 
on the following test:


$ cat foo.rakumod
unit module foo;
use Test;
$ raku -I . -e "use foo"
===SORRY!=== Error while compiling -e
===SORRY!=== Error while compiling /home/kb/foo.rakumod (foo)
No such method 'prefix' for invocant of type 'Capture'
at /home/kb/foo.rakumod (foo):2

at -e:1
$


Interestingly it works fine after the second or third time, and then always, 
until I remove the ~/.raku and .precomp directories...

Maybe it is fine when it somehow managed to get precompiled. And without this 
little innocent patch it is also working.

Can someone enlighten me?

Cheers

Konrad
diff --git a/src/core.c/CompUnit/RepositoryRegistry.pm6 b/src/core.c/CompUnit/RepositoryRegistry.pm6
index 84250e72e..26274464e 100644
--- a/src/core.c/CompUnit/RepositoryRegistry.pm6
+++ b/src/core.c/CompUnit/RepositoryRegistry.pm6
@@ -136,6 +136,7 @@ class CompUnit::RepositoryRegistry {
         my str $core   = 'inst#' ~ $prefix ~ $sep ~ 'core';
         my str $vendor = 'inst#' ~ $prefix ~ $sep ~ 'vendor';
         my str $site   = 'inst#' ~ $prefix ~ $sep ~ 'site';
+        my str $foo    = 'inst#' ~ '/opt/foo/lib';
 
         my str $home;
         my str $home-spec;
@@ -182,6 +183,17 @@ class CompUnit::RepositoryRegistry {
               )
             ) unless nqp::existskey($unique, $site);
 
+            # FOO specific: /opt/foo/lib
+            nqp::bindkey($custom-lib, 'foo',
+              $next-repo := self!register-repository(
+                $foo,
+                CompUnit::Repository::Installation.new(
+                  :prefix('/opt/foo/lib'),
+                  :$next-repo
+                )
+              )
+            ) unless nqp::existskey($unique, $foo);
+
             nqp::bindkey($custom-lib,'home',
               $next-repo := self!register-repository(
                 $home-spec,
@@ -215,6 +227,11 @@ class CompUnit::RepositoryRegistry {
             my \repo := nqp::atkey($repos,$site);
             nqp::bindkey($custom-lib,'site',repo) if repo;
         }
+        # FOO specific: /opt/foo/lib
+        unless nqp::existskey($custom-lib, 'foo') {
+            my \repo := nqp::atkey($repos, $foo);
+            nqp::bindkey($custom-lib, 'foo', \repo) if repo;
+        }
         unless nqp::existskey($custom-lib,'home') {
             if $home-spec {
                 my \repo := nqp::atkey($repos,$home-spec);

Reply via email to