mirror of
https://github.com/nushell/nushell.git
synced 2024-11-26 02:13:47 +01:00
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
This commit is contained in:
parent
55044aa7d6
commit
c5545c59c6
@ -13,10 +13,10 @@ impl Command for SubCommand {
|
|||||||
fn signature(&self) -> Signature {
|
fn signature(&self) -> Signature {
|
||||||
Signature::build("math sqrt")
|
Signature::build("math sqrt")
|
||||||
.input_output_types(vec![
|
.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::Number)),
|
Type::List(Box::new(Type::Float)),
|
||||||
),
|
),
|
||||||
])
|
])
|
||||||
.allow_variants_without_examples(true)
|
.allow_variants_without_examples(true)
|
||||||
@ -54,7 +54,7 @@ impl Command for SubCommand {
|
|||||||
description: "Compute the square root of each number in a list",
|
description: "Compute the square root of each number in a list",
|
||||||
example: "[9 16] | math sqrt",
|
example: "[9 16] | math sqrt",
|
||||||
result: Some(Value::list(
|
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(),
|
Span::test_data(),
|
||||||
)),
|
)),
|
||||||
}]
|
}]
|
||||||
|
Loading…
Reference in New Issue
Block a user