Skip to content

Commit 76162df

Browse files
authored
Fix loaded-symbol check for the staging-repo class (#617)
(try ::($name)) was always False for any loaded class: ::($name) returns the class's type object when bound, type objects coerce to False in Boolean context, and the try wraps a missing-symbol Failure into Any (also False). So the `?? ::($name).new ...` branch never ran; the `!! do { ... $core-repo.resolve(...).distribution ... }` fallback took every call. Drop the try. Bare ::($name) returns the type object when the symbol is bound and a Failure when it is not, so `!~~ Failure` distinguishes them and the fast path can be reached when the class is already loaded (which is always the case once CompUnit::Repository::Staging moves into CORE.setting).
1 parent 76389c8 commit 76162df

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎lib/Zef/Client.rakumod‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ class Zef::Client {
10761076
# for instance).
10771077
my %curfs-new-args = :prefix($staging-at), :name($stage-for-repo.name), :next-repo($stage-for-repo);
10781078
my $curfs-short-name = 'CompUnit::Repository::Staging';
1079-
(try ::($curfs-short-name))
1079+
(::($curfs-short-name) !~~ Failure)
10801080
?? ::($curfs-short-name).new(|%curfs-new-args)
10811081
!! do {
10821082
# Find CURS from the core repository so we can load it by path later

0 commit comments

Comments
 (0)