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));