Skip to content

Commit 1259296

Browse files
author
Kai Schmidt
committed
fix a bug in filled reshape
1 parent 080559d commit 1259296

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

src/algorithm/dyadic/mod.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ use crate::{
2222
Shape, Uiua, UiuaResult,
2323
};
2424

25-
#[cfg(feature = "bytes")]
26-
use super::op_bytes_retry_fill;
2725
use super::{ArrayCmpSlice, FillContext};
2826

2927
impl Value {
@@ -162,18 +160,14 @@ impl Value {
162160
Value::Num(a) => a.reshape(&target_shape, env),
163161
#[cfg(feature = "bytes")]
164162
Value::Byte(a) => {
165-
*self = op_bytes_retry_fill(
166-
take(a),
167-
|mut a| {
168-
a.reshape(&target_shape, env)?;
169-
Ok(a.into())
170-
},
171-
|mut a| {
172-
a.reshape(&target_shape, env)?;
173-
Ok(a.into())
174-
},
175-
)?;
176-
Ok(())
163+
if env.num_fill().is_ok() && env.byte_fill().is_err() {
164+
let mut arr: Array<f64> = a.convert_ref();
165+
arr.reshape(&target_shape, env)?;
166+
*self = arr.into();
167+
Ok(())
168+
} else {
169+
a.reshape(&target_shape, env)
170+
}
177171
}
178172
Value::Complex(a) => a.reshape(&target_shape, env),
179173
Value::Char(a) => a.reshape(&target_shape, env),

0 commit comments

Comments
 (0)