From c5545c59c6144d911fa93b8b346d1322b3491ae1 Mon Sep 17 00:00:00 2001 From: Stefan Holderbach Date: Wed, 11 Oct 2023 21:26:35 +0200 Subject: [PATCH] Fix output types of `math` commands to be narrower (#9740) # Description Those commands either only return `Type::Float` or `Type::Int` Narrow the type to the correct output # User-Facing Changes More correct type in documentation --- crates/nu-command/src/math/sqrt.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/nu-command/src/math/sqrt.rs b/crates/nu-command/src/math/sqrt.rs index 446b916926..f4cb43eb24 100644 --- a/crates/nu-command/src/math/sqrt.rs +++ b/crates/nu-command/src/math/sqrt.rs @@ -13,10 +13,10 @@ impl Command for SubCommand { fn signature(&self) -> Signature { Signature::build("math sqrt") .input_output_types(vec![ - (Type::Number, Type::Number), + (Type::Number, Type::Float), ( Type::List(Box::new(Type::Number)), - Type::List(Box::new(Type::Number)), + Type::List(Box::new(Type::Float)), ), ]) .allow_variants_without_examples(true) @@ -54,7 +54,7 @@ impl Command for SubCommand { description: "Compute the square root of each number in a list", example: "[9 16] | math sqrt", result: Some(Value::list( - vec![Value::test_int(3), Value::test_int(4)], + vec![Value::test_float(3.0), Value::test_float(4.0)], Span::test_data(), )), }]