Skip to content

Commit

Permalink
prevent some cases of non-scalar repeat
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Jun 16, 2024
1 parent 4f0ded6 commit 72de34d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/algorithm/loops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ pub fn repeat(env: &mut Uiua) -> UiuaResult {
} else {
// Array
let sig = f.signature();
if sig.args != sig.outputs {
return Err(env.error(format!(
"{} with a non-scalar repetition count \
must use a function with the same number \
of arguments and outputs, but its signature \
is {sig}",
Primitive::Repeat.format()
)));
}
// Collect arguments
let mut args = Vec::with_capacity(sig.args + 1);
let new_shape = n.shape().clone();
Expand Down
1 change: 0 additions & 1 deletion todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
- Stack-source locality tutorial
- Axis swizzles?
- Rewrite .uasm format
- Macro args doc comments
- Fix pad cursor jumping with end-of-line comments
- Unicode literals
- Plots
Expand Down

0 comments on commit 72de34d

Please sign in to comment.