From 4dbdb1fe54824d747cb6b421e90bcca77d81666c Mon Sep 17 00:00:00 2001 From: Stefan Holderbach Date: Sun, 23 Jul 2023 20:36:53 +0200 Subject: [PATCH] Add explicit input types for vectorized `into int` form (#9741) # Description Don't just use `List`, be precise for the vectorized form as well. # User-Facing Changes More explicit albeit verbose type information in the signature --- crates/nu-command/src/conversions/into/int.rs | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/crates/nu-command/src/conversions/into/int.rs b/crates/nu-command/src/conversions/into/int.rs index 0d3e9dbdc..50c5019cd 100644 --- a/crates/nu-command/src/conversions/into/int.rs +++ b/crates/nu-command/src/conversions/into/int.rs @@ -37,9 +37,33 @@ impl Command for SubCommand { // Unix timestamp in nanoseconds (Type::Date, Type::Int), (Type::Duration, Type::Int), - // TODO: Users should do this by dividing a Filesize by a Filesize explicitly (Type::Filesize, Type::Int), (Type::Table(vec![]), Type::Table(vec![])), + ( + Type::List(Box::new(Type::String)), + Type::List(Box::new(Type::Int)), + ), + ( + Type::List(Box::new(Type::Number)), + Type::List(Box::new(Type::Int)), + ), + ( + Type::List(Box::new(Type::Bool)), + Type::List(Box::new(Type::Int)), + ), + ( + Type::List(Box::new(Type::Date)), + Type::List(Box::new(Type::Int)), + ), + ( + Type::List(Box::new(Type::Duration)), + Type::List(Box::new(Type::Int)), + ), + ( + Type::List(Box::new(Type::Filesize)), + Type::List(Box::new(Type::Int)), + ), + // Relaxed case to support heterogeneous lists ( Type::List(Box::new(Type::Any)), Type::List(Box::new(Type::Int)),