From 125929668d62e3d37c0545e1c52a45831c4ede63 Mon Sep 17 00:00:00 2001 From: Kai Schmidt Date: Wed, 3 Jan 2024 14:36:15 -0800 Subject: [PATCH] fix a bug in filled reshape --- src/algorithm/dyadic/mod.rs | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/algorithm/dyadic/mod.rs b/src/algorithm/dyadic/mod.rs index d2b5a82f2..67aafc63b 100644 --- a/src/algorithm/dyadic/mod.rs +++ b/src/algorithm/dyadic/mod.rs @@ -22,8 +22,6 @@ use crate::{ Shape, Uiua, UiuaResult, }; -#[cfg(feature = "bytes")] -use super::op_bytes_retry_fill; use super::{ArrayCmpSlice, FillContext}; impl Value { @@ -162,18 +160,14 @@ impl Value { Value::Num(a) => a.reshape(&target_shape, env), #[cfg(feature = "bytes")] Value::Byte(a) => { - *self = op_bytes_retry_fill( - take(a), - |mut a| { - a.reshape(&target_shape, env)?; - Ok(a.into()) - }, - |mut a| { - a.reshape(&target_shape, env)?; - Ok(a.into()) - }, - )?; - Ok(()) + if env.num_fill().is_ok() && env.byte_fill().is_err() { + let mut arr: Array = a.convert_ref(); + arr.reshape(&target_shape, env)?; + *self = arr.into(); + Ok(()) + } else { + a.reshape(&target_shape, env) + } } Value::Complex(a) => a.reshape(&target_shape, env), Value::Char(a) => a.reshape(&target_shape, env),