Tracking: implicit-conversion / flat-path coercion arc → Rust numeric model
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 14
- Forks
- 2
- Avg merge
- 12h 42m
- Merged PRs (30d)
- 61
Description
Master task for the type-conversion + flat-path coercion arc: make the flat codegen path handle Vx's implicit numeric coercions correctly, then adopt Rust's stricter model (no implicit conversions; literals infer to context) and delete the coercion machinery. Groups the work done this arc and what remains.
Done ✅
Phase 1 — flat path correct under Vx's old (permissive) semantics (unblocked the flat corpus, flat-used 61 → 87):
- hiraditya/Vx.1#231 — string values (
let s = "…", string args):LoweredTy::Ptr+StringConstopcode.95cfbdc - Extern symbols are module-independent (dedup
vx_stdout_writeacross a program +std::io).5898f30 - hiraditya/Vx.1#235 — FFI pointer ABI (
*const/*mut/&as params/returns/args/memory-mode locals, pointer-returning externs).95cfbdc - hiraditya/Vx.1#236 — coerce call arguments to parameter types (type checker).
2ec70d6(later removed by hiraditya/Vx.1#240 Stage B) - hiraditya/Vx.1#237 — coerce binary-op / comparison / compound-assign operands (flat lowerer).
adae4c5(later removed by hiraditya/Vx.1#240 Stage B) - hiraditya/Vx.1#238 — materialize implicit coercions in the flat lowerer (let slot, assignment,
TensorStore, struct field, value-if, return).adae4c5,5062c95(later removed by hiraditya/Vx.1#240 Stage B)
Phase 2 — adopt Rust's numeric model (#240), which superseded Phase 1 by removing the reason it existed:
- hiraditya/Vx.1#240 Stage A — unsuffixed literals are untyped (
ty: None) and infer to context; one shareddefault_number_elemfallback for the checker and the flat lowerer. Non-breaking behind still-permissiveis_assignable.b71fdf0 - hiraditya/Vx.1#240 Stage B —
is_assignablescalar rule tightened to identical-only (no implicit numeric conversion). Inference wired at every checking position (check_operand_pairfor binary/relational/logical operands + range bounds; assignment/compound RHS; array-literal elements; call args viarefine_literal_arg). Deletedcoerce_val(#238) andcoerce_call_arg(#236) — a probe confirmed zero residual casts. Nine-program explicit-asmigration; stdlib needed none.14719b4 - Design docs + journal (Entries 55–61):
flat_call_argument_coercion.md,rust_numeric_model.md(§8 Stage A, §9 Stage B).
Key finding (drove the design): coercion is codegen-type-dependent (a loop var is MLIR index in the AST codegen, i64 then i32 in the flat lowerer), so materialization belonged per-backend — until hiraditya/Vx.1#240 removed implicit conversion entirely, making both backends agree by construction.
Latent bugs the Stage B tightening exposed and fixed (coercion had hidden them): for-loop induction variables were hardcoded i64 in the checker (now take the range's element type, matching the flat lowerer); array literals and Vec<i32> indexing defaulted their element type to f32 (now resolved from the first element / the container's data : *mut T field).
Planned 🔜
- hiraditya/Vx#239 — lower the expression constructs the flat path still declines (method / closure / fn-pointer calls, value-
match, array literals, logical ops). Now pure lowering: with hiraditya/Vx.1#240 done there is no implicit coercion at these value positions. - hiraditya/Vx.1#235 — remainder: scalar/aggregate
&x/*pand void externs (no corpus driver yet). - hiraditya/Vx.1#233 — data-carrying (tagged-union) enums + value-producing
match. Blocked: the AST oracle itself fails MLIR verification on a user-defined tagged union; also needs genericOption<T>+Vecfor the one corpus driver. - (optional UX) point a scalar-mismatch error explicitly at
as(the message is clear but doesn't yet name the fix).
Sequencing note
hiraditya/Vx.1#240 is complete, so hiraditya/Vx#239 is now pure lowering (no coercion follow-ups). hiraditya/Vx.1#235's remaining pointer work is independent. hiraditya/Vx.1#233 waits on an AST-path fix or the generics/Vec surface.
Part of the flat-codegen convergence (#200/#201).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the rust_numeric_model.md and flat_call_argument_coercion.md design documents, then choose one of the remaining linked tasks: #239, #235, or the blocked #233. The issue names no source file or test; done means completing the selected lowering, pointer, or enum/match work while preserving agreement between the AST and flat paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100