From 8833d3f89f114f3fdfaa4022e35153e9d167921c Mon Sep 17 00:00:00 2001 From: Darren Schroeder <343840+fdncred@users.noreply.github.com> Date: Fri, 5 Jul 2024 07:16:03 -0500 Subject: [PATCH] change duration mod duration to duration instead of float (#13300) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Description closes #13298 so that duration mod duration / duration = duration ### Before ```nushell (92sec mod 1min) / 1sec Error: nu::parser::unsupported_operation × division is not supported between float and duration. ╭─[entry #5:1:1] 1 │ (92sec mod 1min) / 1sec · ────────┬─────── ┬ ──┬─ · │ │ ╰── duration · │ ╰── doesn't support these values · ╰── float ╰──── ``` ### After ```nushell ❯ (92sec mod 1min) / 1sec 32 ``` # User-Facing Changes # Tests + Formatting # After Submitting --- crates/nu-parser/src/type_check.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/nu-parser/src/type_check.rs b/crates/nu-parser/src/type_check.rs index 1c76afb621..872bb6a94c 100644 --- a/crates/nu-parser/src/type_check.rs +++ b/crates/nu-parser/src/type_check.rs @@ -292,7 +292,7 @@ pub fn math_result_type( (Type::Filesize, Type::Filesize) => (Type::Float, None), (Type::Filesize, Type::Int) => (Type::Filesize, None), (Type::Filesize, Type::Float) => (Type::Filesize, None), - (Type::Duration, Type::Duration) => (Type::Float, None), + (Type::Duration, Type::Duration) => (Type::Duration, None), (Type::Duration, Type::Int) => (Type::Duration, None), (Type::Duration, Type::Float) => (Type::Duration, None),