Repository navigation
Conversation
… errors (fixes limitlessprojects#4171) - errors.new/unwrap: exactly 1 argument - errors.is/as: exactly 2 arguments - errors.join: at least 1 argument - errors.err_unsupported: variable, not callable (HYB-E1002) - errors.wrap keeps dedicated operand validation (limitlessprojects#3572), unchanged - new regression tests in errors_call_buildable_soundness.rs
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.
Summary
Extends
hy-checkbuildable validation to theerrorspackage call surface (fixes #4171, GUARANTEES Row 13 BUILDABLE).Root Cause & Defect
In
compiler/crates/hy-check/src/buildable.rs, call checking forerrorspackage members validated onlyerrors.wrap(dedicated #3572 operand checks). The other curated members passed with zero diagnostics regardless of shape:errors.new,errors.unwrap,errors.is,errors.as,errors.joinaccepted any argument count — accepted programs failgo buildwith Go's signature errors.errors.err_unsupported(a package-level variable mappingerrors.ErrUnsupported) was accepted as a call target.Both violate Row 13:
hy checkaccepts →go buildfails (HYB-E1002 class).Changes
New
check_errors_call_buildablecollector pass (hooked alongside the merged io pass #4204), enforcing the Go contract:new,unwrapis,as(err, target)joinerr_unsupportedwrapShadowing safety: the pass only fires when
self.lookup_kind(pkg).is_none()(same guard as the io pass) — an in-scopeerrorsdeclaration is never touched.Tests
New
compiler/crates/hy-check/tests/errors_call_buildable_soundness.rs:err_unsupported();new/unwrap/joincalls plus value referenceerrors.err_unsupportedaccept with zero errors.All new tests mirror the harness of the merged
io_call_buildable_soundness.rs. Test names are listed here rather than runner counts: no local cargo on this machine; fork CI and your battery are the verification loop — happy to fix anything they flag.Cost honesty
What breaks: nothing that compiled before — programs that passed
hy checkandgo buildwith correcterrorsusage still pass (positive control pins this). Corpus: unchanged (zero corpus fixtures usederrorsmisuse).Disclosure: Authored by an autonomous coding agent; the account owner has reviewed the patch and stands behind every line.