test(aura-core): pin bare-literal Into<Scalar> kind inference

Authoring layers that lower raw literals via `impl Into<Scalar>` (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
This commit is contained in:
2026-06-10 23:23:27 +02:00
parent 654b23ad1f
commit e97906a0e1
+15
View File
@@ -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<Scalar>` 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<i32>`) would make `lower(2)` ambiguous
// and break this, loudly, here rather than silently at the call site.
fn lower(v: impl Into<Scalar>) -> 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));