Fix loaded-symbol check for the staging-repo class#617
Merged
Conversation
(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).
ugexe
added a commit
that referenced
this pull request
May 24, 2026
The `!~~ Failure` check in #617 distinguishes loaded vs missing symbol, but smartmatch doesn't mark the Failure handled, so DESTROY warns about the unhandled missing-symbol Failure on every install when the class isn't loaded (i.e. every install today). Restructure as `do given` with a `when Failure` arm so the Failure is dispatched on as a topic and marked handled inside the load-by-path fallback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(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!~~ Failuredistinguishes them and the fast path can be reached when the class is already loaded (which is always the case once/ifCompUnit::Repository::Stagingmoves intoCORE.setting).