From 64f34e028736c312ac432fb2f6ac51a9089e7692 Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Sun, 21 Jan 2024 08:41:23 -0600 Subject: [PATCH] allow math avg to work with durations (#11598) # Description I ran into a problem where one of our benchmark tests in nu_scripts wouldn't work because math avg wouldn't work with durations, so I made these changes to support it. I'm confident that there are other math commands that probably need this "fix". Side note - we should really fix our inout_output_type system. # User-Facing Changes # Tests + Formatting # After Submitting --- crates/nu-command/src/math/avg.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/nu-command/src/math/avg.rs b/crates/nu-command/src/math/avg.rs index 460a78cfd2..09c841ef57 100644 --- a/crates/nu-command/src/math/avg.rs +++ b/crates/nu-command/src/math/avg.rs @@ -18,9 +18,12 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("math avg") .input_output_types(vec![ - (Type::List(Box::new(Type::Number)), Type::Number), (Type::List(Box::new(Type::Duration)), Type::Duration), + (Type::Duration, Type::Duration), (Type::List(Box::new(Type::Filesize)), Type::Filesize), + (Type::Filesize, Type::Filesize), + (Type::List(Box::new(Type::Number)), Type::Number), + (Type::Number, Type::Number), (Type::Range, Type::Number), (Type::Table(vec![]), Type::Record(vec![])), (Type::Record(vec![]), Type::Record(vec![])),