Repository navigation
Conversation
|
Shepherd (Phase A — propose only): this PR's changed-file set overlaps >=0.6 Jaccard with #106, which carries the larger take. Proposing close as superseded. This is a proposal, not a close — nothing auto-closes while this comment is fresh. If this PR has unique content (a different rule, extra tests, a different fix), say so or push, and the label comes off. Cluster signal is a file-set heuristic; the verdict stays human. |
Prior-Art & First-Reporter Notice (
|
| Artifact | Author | Created (UTC) | Coverage |
|---|---|---|---|
| Issue #105 | @sonson0910 |
2026-10-15T01:49:18Z |
Reports TypeShape::Struct dropping generic type arguments (box[map[string]int], lru_cache[string, int]) across shape.rs, sendability.rs, freeze.rs, loans.rs, and closures.rs. |
| PR #106 | @sonson0910 |
2026-10-15T01:52:46Z |
Preserves and substitutes generic struct type arguments across shape.rs, sendability.rs, freeze.rs, loans.rs, closures.rs, emit_guard.rs, and lib.rs (synced to latest main, behind_by = 0). |
| Issue #772 / PR #779 | @aazminu |
2026-10-19T03:38:03Z / 03:51:10Z (+98h later) |
Duplicate report and fix for generic struct type arguments in shape.rs and loans.rs. |
…d loan checks
`named_shape_depth` previously stripped generic type arguments via
`base_named_type_str` (`box[[]int]` -> `TypeShape::Struct(Some("box"))`),
and `shape_may_share_at`, `shape_carries_handle_at`, `field_shape`,
`call_shape`, `ty_of_expr`, `no_zero_value_reason`, `place_target_ty`,
`check_composite_nils`, and `shape_holds_*` looked up raw un-substituted
field types in `self.structs.get("box")` where `T` resolved to
`TypeShape::Unknown`.
Preserve the instantiated generic struct name in `TypeShape::Struct(Some(name))`
and substitute declared struct/function/method type parameters through
`struct_fields_for_sname` and `fn_subst_for_state`, while normalizing
receiver base names when looking up method declarations.
Fixes limitlessprojects#772
17b976b to
783da43
Compare
|
Queue-reset sweep: this repo now runs a rolling conveyor, and open PRs This is not a verdict on the work. If this change still matters:
Wildcard holds (verdict window 2026-11-01) and Pareto land candidates are |
Summary
Fixes #772
Checker::named_shape_depthpreviously stripped generic type arguments from instantiated struct types (box[[]int]->TypeShape::Struct(Some("box"))), and downstream shape, sendability, loan, freeze, and nil/zero-value checks looked up raw un-substituted field types inself.structs.get(base)wheretresolved toTypeShape::Unknown:HYB-E3003) & non-owned move (HYB-E3004):shape_may_share_atandfield_shapereturnedfalse/Unknownonbox[[]int], allowing aliases of generic structs holding slices/maps to mutate shared storage aftermoveinto a task and allowingreturn move b.von non-owned parameters.constdeep immutability (HYB-E3006):shape_is_proven_pure_valueandfield_shapefailed to classifyconst cb box[[]int]copies and field projections as const-backed reference aliases.HYB-E3001/HYB-E3002/HYB-E3003):shape_may_share,shape_carries_handle,shape_holds_closure, andshape_holds_unmovable_leafignored substituted type arguments on generic structs.HYB-E3102):&b.v["a"]onbox[map[string]svc]did not resolveb.vasTypeShape::Map(...).HYB-E4001) & N3 (HYB-E4002):check_composite_nils,place_shape, andno_zero_value_reasondid not substitute type parameters on generic struct fields.Changes
compiler/crates/hy-check/src/shape.rs: Keep the full instantiated name inTypeShape::Struct(Some(name.to_string()))and substitute generic type arguments viastruct_fields_for_sname/fn_subst_for_stateinshape_may_share_at,shape_carries_handle_at,struct_has_mutex_field,field_shape,call_shape,ty_of_expr,no_zero_value_reason, andcall_result_tys_with_args.compiler/crates/hy-check/src/sendability.rs: Exposestruct_fields_for_snameandfn_subst_for_stateand use substituted field types inshape_holds_closure,shape_holds_unmovable_leaf,shape_is_const_sendable,check_composite_nils,spawn_param_shapes, andshape_may_be_elem.compiler/crates/hy-check/src/loans.rs,freeze.rs,emit_guard.rs: Usestruct_fields_for_snameinplace_target_ty,shape_is_proven_pure_value,incomparable_rec, and struct literal constant-overflow checks, and normalize struct receiver / generic function names when queryingself.fnsandself.method_decls.compiler/crates/hy-check/tests/generic_struct_soundness_issue_772.rs: Add regression tests coveringHYB-E3001,HYB-E3002,HYB-E3003,HYB-E3004,HYB-E3006,HYB-E3102,HYB-E4001,HYB-E4002, and pure-valuebox[int]negative controls.Verification
cargo test -p hy-check -p hy-emit -p hy-syntax -p hy-diag