Repository navigation
Conversation
Automated review — gate FAIL (premise overturned by emit probes; the patch would false-reject currently-building programs)Ran the exact scenarios from the suite against current main ( 1.
n, hyErr0 := strconv.ParseInt("42", 10, 64)A synthetic error binding ( 2.
3. That is a loud pipeline-level rejection, not a silent BUILDABLE hole; and it fires for every 3-result function regardless of So the landed tuple.rs contract (" Landable paths:
Happy to re-run the full battery on a re-push that keeps probes 1–2 accepting. |
|
Re-scoped the check to reject 3+ result calls with 1 binding only ( Probes 1 and 2 remain accepted with 0 diagnostics:
The suite in
All unit and integration tests in |
Summary
Fixes a soundness and buildability bug (violating Row 13 of
GUARANTEES.md) wherestatic_result_countinhy-check/src/tuple.rsignoredExpr::Try, under the assumption that?-unwrapping always yields a single value.In Hybrid, functions returning
(T1, T2, error)unwrap under?to 2 values (as demonstrated in accept-corpus test 10:code, body := httptest.get(...)). When a user wrote:static_result_countreturnedNonebecause the top-level expression wasExpr::Tryrather thanExpr::Call.buildable.rsbypassed binding positions withif binding_position { return; } // E2002 owns this shape.hy-checkaccepted the program with 0 diagnostics (Verdict::Accept).hy-emitemittedp, hyErr := pair_and_err(), which failedgo buildwithassignment mismatch: 2 variables but pair_and_err returns 3 values.Symmetrically, binding two variables to a single-value fallible call
a, b := single_err()?passedhy-checkand failedgo buildwithassignment mismatch: 3 variables but single_err returns 2 values.Fix
In
compiler/crates/hy-check/src/tuple.rs:Expr::Tryinstatic_result_count(), recording that error unwrapping occurred.is_try, subtract 1 from the callee's declared return arity. Void / 0-value results remain owned bybuildable.rs.HYB-E2002(multi-value tuple rejection) orHYB-E1002(binding mismatch) prior to emission.Verification & Tests
Added
compiler/crates/hy-check/tests/try_multi_value_tuple_e2002.rscovering:try_multi_value_single_bind_rejected_e2002(p := pair_err()?->HYB-E2002)try_multi_value_exact_bind_accepted(a, b := pair_err()?-> 0 diagnostics)try_single_value_over_bind_rejected_e1002(a, b := single_err()?->HYB-E1002)try_multi_value_let_and_var_rejected_e2002(let p = ...,var p = ...->HYB-E2002)try_multi_value_assign_rejected_e2002(p = pair_err()?->HYB-E2002)try_foreign_package_over_bind_rejected_e1002(a, b := strconv.parse_int(...)->HYB-E1002)try_foreign_package_exact_bind_accepted(n := strconv.parse_int(...)-> 0 diagnostics)All tests pass cleanly.
Settlement
0xAF9192689F02C02A513983Def82113290360Bb6B(USDC on Base network)