You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This content was written by an AI agent and must be verified by a human developer. After human verification, this alert may be removed.
Summary
27 functions in crates/graphcal-compiler/src/tir/dim_check/infer/hir.rs (5283 lines) carry #[expect(clippy::too_many_arguments, ...)], each threading the same ambient parameter bundle. The context struct that solves this already exists one directory up and is already used by two sibling modules — the infer/ submodule was simply never migrated.
The reason strings are themselves the tell: "mirrors syntax inference context", "mirrors infer_hir_type's signature". There is a context object; it just is not reified here.
Affected functions include infer_hir_type, infer_hir_type_inner, infer_arg, infer_hir_fn_call, infer_hir_binop, infer_hir_if, infer_hir_for_comp, infer_hir_index_access, infer_hir_field_access, infer_hir_constructor_call, infer_hir_scan, infer_hir_unfold, infer_hir_match, infer_hir_dag_call and others.
Mechanically, in this one file: 85 bare registry, threading lines and 69 bare builtin_fns, threading lines.
/// Per-DAG context bundle threaded through the dimension-check passes.////// Bundles the read-only inputs that every per-declaration check needs/// (declared types, the locals scope, TIR, registry, builtins, source)/// so individual helpers take a single `&DimCheckContext` instead of/// six positional arguments.#[derive(Clone,Copy)]structDimCheckContext<'a>{cancellation:&'acrate::cancellation::CancellationToken,materialized_shapes:&'a infer::hir::MaterializedShapeCollector,declared_types:&'aHashMap<ScopedName,DeclaredType>,dag:Option<&'acrate::tir::typed::DagTIR>,tir:&'acrate::tir::typed::TIR,registry:&'aSemanticRegistry,builtin_fns:&'acrate::registry::builtins::BuiltinFunctions,src:&'aNamedSource<Arc<String>>,}
It is already used by dim_check/mod.rs and dim_check/plot.rs.
Suggested fix
Introduce an InferCtx<'a> (or reuse/extend DimCheckContext) carrying the invariant fields, leaving only the genuinely varying arguments (expr, local_types, owner_decl_name) positional.
Expected effect: ~27 #[expect] attributes and several hundred argument-threading lines removed from the largest non-test file in the compiler.
Sequencing note
This is the largest diff of the review's findings and touches the file most likely to conflict with other in-flight work. Worth landing alone, on its own branch, with no behavioural change — the 2926-test suite is the oracle.
Provenance
Found during a full-workspace code review at 6e462341a (v0.0.1-alpha.27). Baseline at that commit: cargo clippy --workspace --all-targets clean, cargo test --workspace 2926 passed / 0 failed, cargo deny check advisories ok.
Warning
This content was written by an AI agent and must be verified by a human developer. After human verification, this alert may be removed.
Summary
27 functions in
crates/graphcal-compiler/src/tir/dim_check/infer/hir.rs(5283 lines) carry#[expect(clippy::too_many_arguments, ...)], each threading the same ambient parameter bundle. The context struct that solves this already exists one directory up and is already used by two sibling modules — theinfer/submodule was simply never migrated.Current shape
The
reasonstrings are themselves the tell:"mirrors syntax inference context","mirrors infer_hir_type's signature". There is a context object; it just is not reified here.Affected functions include
infer_hir_type,infer_hir_type_inner,infer_arg,infer_hir_fn_call,infer_hir_binop,infer_hir_if,infer_hir_for_comp,infer_hir_index_access,infer_hir_field_access,infer_hir_constructor_call,infer_hir_scan,infer_hir_unfold,infer_hir_match,infer_hir_dag_calland others.Mechanically, in this one file: 85 bare
registry,threading lines and 69 barebuiltin_fns,threading lines.The remedy already exists
crates/graphcal-compiler/src/tir/dim_check/mod.rs:282:It is already used by
dim_check/mod.rsanddim_check/plot.rs.Suggested fix
Introduce an
InferCtx<'a>(or reuse/extendDimCheckContext) carrying the invariant fields, leaving only the genuinely varying arguments (expr,local_types,owner_decl_name) positional.Expected effect: ~27
#[expect]attributes and several hundred argument-threading lines removed from the largest non-test file in the compiler.Sequencing note
This is the largest diff of the review's findings and touches the file most likely to conflict with other in-flight work. Worth landing alone, on its own branch, with no behavioural change — the 2926-test suite is the oracle.
Provenance
Found during a full-workspace code review at
6e462341a(v0.0.1-alpha.27). Baseline at that commit:cargo clippy --workspace --all-targetsclean,cargo test --workspace2926 passed / 0 failed,cargo deny check advisoriesok.