Repository navigation
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 163cba06ce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82a9541377
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| CallableDef::Func(func) => func | ||
| .params(db) | ||
| .nth(idx) | ||
| .map(|param| param.mode(db).into()) | ||
| .unwrap_or(LogicalCallableParamMode::View), |
There was a problem hiding this comment.
Preserve ref and mut modes in logical signatures
For an ordinary function parameter such as target: mut u256 or value: ref T, FuncParamMode is View because the ref/mut information lives in the carrier type. Converting only param.mode here and then stripping the carrier below renders the parameter as plain target: u256/value: T in signature help, hover, and inlay hints, hiding the required call-site capability. Derive Ref/Mut from capability-bearing carriers before falling back to the function parameter mode.
Useful? React with 👍 / 👎.
| let mode = closure_modes | ||
| .and_then(|modes| modes.get(idx).copied()) | ||
| .or_else(|| ClosureParamMode::try_from_carrier(db, carrier)) | ||
| .unwrap_or(ClosureParamMode::View); |
There was a problem hiding this comment.
Treat unresolved packed parameters as owned
For a generic callable such as F: Fn<(T,), U>, the pack field is a TyParam, so try_from_carrier returns None and this fallback marks the argument as View. The type checker, however, treats every non-capability pack element as Own, so signature help reports _: T even though invoking the callable consumes the T; the identical fallback in signature_from_trait_inst also mislabels hover and completion details. Unknown bare pack carriers should default to Own, reserving View for an explicit capability carrier.
Useful? React with 👍 / 👎.
| let args = param_names | ||
| .iter() | ||
| .enumerate() | ||
| .map(|(idx, name)| format!("${{{}:{name}}}", idx + 1)) | ||
| .collect::<Vec<_>>() |
There was a problem hiding this comment.
Insert capability prefixes in callable snippets
When a callable value has a ref or mut logical parameter, this builds the invocation arguments from names alone, so accepting completion for a closure such as |slot: mut u256| ... inserts update(slot) rather than the required update(mut slot) (and likewise omits ref). The type checker requires those explicit capability arguments for place values, making the newly inserted snippet invalid even though the completion detail correctly advertises the mode.
Useful? React with 👍 / 👎.
| for &inst in enclosing_assumptions(db, scope).list(db) { | ||
| if inst.self_ty(db) != payload { | ||
| continue; | ||
| } | ||
| let Some(call_trait) = ClosureCallTrait::for_trait(db, scope, inst.def(db)) else { | ||
| continue; |
There was a problem hiding this comment.
Expand supertraits when discovering generic callables
For a generic value constrained through a custom supertrait, such as trait Unary: Fn<(u256,), u256> and F: Unary, the compiler can invoke F through the implied Fn bound, but this loop examines only the directly declared Unary assumption. Because Unary is not itself recognized as a core call trait, callable hover and invocation completions disappear for otherwise callable values; expand the assumption list with its implied bounds before filtering for Fn/FnOnce.
Useful? React with 👍 / 👎.
Introduce closure literals across the parser, formatter, HIR, type checker, semantic lowering, runtime lowering, and editor grammar. Establish nominal closure bodies and initial callable dispatch with end-to-end regression coverage.
Model capture access and move modes explicitly, distinguish reusable and consuming closures, and carry captured loans through semantic analysis. Enforce borrow, move, and noesc rules across direct and generic callable paths.
Adopt one tuple-packed Fn/FnOnce argument ABI for every arity while retaining source-level parameter modes. Add contextual parameter and result inference, and preserve exact layout and borrow provenance through the physical pack.
Finish closure specialization across semantic instances, layout evidence, effects, MIR interfaces, and runtime lowering. Preserve callable ownership and provider semantics through generic dispatch and contract execution.
Regenerate Sonatina snapshots and the vendored Tree-sitter WebAssembly output after the closure runtime and grammar changes.
Bring the compiler parser, Tree-sitter scanner, highlighting queries, corpus, and vendored editor grammar into agreement for inferred and mode-qualified closure parameters.
Make deferred closure typing transactional and replay contextual constraints through calls, projections, aliases, effects, and method selection. Preserve nominal closure identity while allowing valid generic inference to converge.
Close the remaining soundness gaps in borrow checking, definite assignment, semantic normalization, layout evidence, and program-point invalidation. Strengthen non-regular recursion analysis for closure-heavy generic graphs.
Retain callable environments and capability-bearing carriers only when their runtime identities escape. Keep reusable and consuming closure ABIs stable through materialization, specialization, and code generation.
Resolve value(args) through the core Fn and FnOnce traits, preferring reusable dispatch before consuming fallback. Keep ordinary functions and constructors on their existing path, improve logical diagnostics, and exercise direct syntax throughout the standard library and closure regression matrix.
Expose one source-level callable signature and target view that hides the receiver-plus-tuple trait ABI. Use exact selected calls and applicable, specialized callable impls to power signature help and rich closure hover.
Keep callable values available as values while adding invocation snippets for locals, parameters, and fields. Parenthesize callable-field edits correctly, enumerate distinct overloads, and filter inapplicable specializations.
Navigate callable values to closure literals and applicable implementations, keep call hierarchy at source-level closure targets, and include contract initializers and receive arms. Add logical parameter hints and a structured callable-field parenthesization fix.
Use resolved argument spans for signature-help selection so closure parameter commas stay inside the enclosing argument. Preserve explicit callable receivers for UFCS and expose stored function-item signatures to hover, completion, and inlay hints.
Derive ref and mut modes from carrier types, treat unresolved packed arguments as owned, expand implied call-trait bounds, and emit capability-correct invocation snippets.
No description provided.