Repository navigation
fix(hy-check): track user-defined methods and receiver/struct sharing (#120) - #121
sonson0910 wants to merge 1 commit into
Conversation
167e519 to
07df4a8
Compare
07df4a8 to
4d9ad38
Compare
|
Triage (2026-10-15, AI maintainer): real gap (#120 — method calls, struct-to-reference extractions, ?-unwrapped call results bypass receiver/struct sharing), and the approach composes with the seam that just landed (pr-162's generalized collect_ref_roots covers part of the same reach — your receiver/ |
|
Thank you for the triage note! Heads-up: GitHub automatically closed this PR (#121) at I have rebased |
|
Confirmed and thank you for the precise diagnosis (and for opening #197 with the rebase already done — exactly the right move). The |
Fixes #120
Bounty track: #5
Summary
Closes the
hy-checksoundness gap where user-defined methods (fn (r T) method(...)) were dropped during table construction and method receivers (callee = Expr::Field { base, .. }), reference-bearing composite arguments (extract(h)), multi-value unpacks (n, m := h.pair()), and?-unwrapped calls (Expr::Try) bypassed A1b alias/may-share freeze andnon_owned_originpropagation.What Changed
compiler/crates/hy-check/src/model.rs&compiler/crates/hy-check/src/lib.rs:methods: HashMap<(String, String), &'a FnDecl>toChecker<'a>.f.receiver.is_some()) by(receiver_struct_name, method_name)inbuild_tableswhile keeping top-level functions inck.fns.compiler/crates/hy-check/src/shape.rs:lookup_user_method(resolving both valueSand pointer*Sstruct receivers) andresolve_call_decl.call_shape,ty_of_expr,multi_value_shapes, andmulti_value_tysto resolve user-defined method return shapes and types.compiler/crates/hy-check/src/loans.rs:process_call(Resolved::Method), lent handle arguments for user-defined method calls (lend_handle_args, A7 borrow-by-default).unwrap_parens_and_try,link_share,call_source_roots, andrecord_call_sharingto link non-moved method receivers (callee = Expr::Field { base, .. }) and call arguments (binding_may_share) intost.may_share/st.aliasesand propagatenon_owned_originacross single-value defines, rebinds, multi-value unpacks (n, m := h.pair(),n, m = h.pair()), and?-unwrapped calls (m := h.try_data()?).compiler/crates/hy-check/src/lib.rs):user_method_call_extracting_map_freezes_receiver_on_move_e3003user_method_call_rebind_and_ascribed_define_freeze_receiver_e3003toplevel_fn_extracting_map_from_struct_freezes_arg_on_move_e3003non_owned_receiver_and_param_extractions_reject_move_e3004multi_return_and_try_calls_track_sharing_and_freeze_e3003Verification
cargo test --manifest-path compiler/Cargo.toml --workspace: all tests pass (including 5 new unit tests inhy-check).cargo clippy --manifest-path compiler/Cargo.toml --workspace --tests -- -D warnings: 0 warnings.python3 tools/corpus_harness.py:27/27verdict agreement, tripwire not fired.python3 tools/differential_loop.py:10/10accept-side,17/17reject-side,FULL AGREEMENT.method_repro.hyfrom [soundness] User-defined method calls, struct-to-reference extractions, and ?-unwrapped calls bypass A1b freeze #120 is now rejected withHYB-E3003(tier0_rule: "A1b").Payout / Wallet Addresses (Bounty Track #5)
TCQwxbpYVdRWYNDs1JbnKyVHNRVaRJg1io0x76d1c4283a2ff662ccf85c1f57655c29b42567566dX8oqvvHj6Q936PVyTjVYKVk45soNpJ234aVqMm6ZJm