From e97906a0e1930997c374d67ac9cded47e41b1a43 Mon Sep 17 00:00:00 2001 From: Brummel Date: Wed, 10 Jun 2026 23:23:27 +0200 Subject: [PATCH] test(aura-core): pin bare-literal Into kind inference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Authoring layers that lower raw literals via `impl Into` (the named-param-binding surface, spec 0030 / #35) rely on a bare integer literal inferring as i64 and a bare float as f64 — because i64/f64/bool are the only `From<…> for Scalar` impls, each literal class resolves to exactly one. This was true but untested: `from_widenings` uses suffixed literals (`7i64`), so a regression in the inference path would survive it. Behaviour-preserving pin of existing aura-core behaviour. Closes the one grounding gap the grounding-check flagged on spec 0030; also guards the property independently — adding a second integer `From` impl would now break loudly here rather than silently at a `.with("knob", 2)` call site. refs #35 --- crates/aura-core/src/scalar.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/aura-core/src/scalar.rs b/crates/aura-core/src/scalar.rs index 21412a2..5767167 100644 --- a/crates/aura-core/src/scalar.rs +++ b/crates/aura-core/src/scalar.rs @@ -86,6 +86,21 @@ mod tests { assert_eq!(Scalar::from(Timestamp(9)), Scalar::Ts(Timestamp(9))); } + #[test] + fn bare_literal_infers_kind_through_into_scalar() { + // Authoring layers that lower raw literals via `impl Into` rely on + // a bare (unsuffixed) integer literal inferring as `i64` and a bare float + // literal as `f64` — because `i64`/`f64`/`bool` are the only `From` impls, + // each literal class resolves to exactly one of them. Adding a second + // integer `From` impl (e.g. `From`) would make `lower(2)` ambiguous + // and break this, loudly, here rather than silently at the call site. + fn lower(v: impl Into) -> Scalar { + v.into() + } + assert_eq!(lower(2), Scalar::I64(2)); + assert_eq!(lower(0.5), Scalar::F64(0.5)); + } + #[test] fn timestamp_orders_and_defaults() { assert!(Timestamp(1) < Timestamp(2));