Skip to content

Commit

Permalink
fix a bug in repeat signature inference
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Apr 8, 2024
1 parent 5173e83 commit a8f72b3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
Uiua is not yet stable.
<!-- This version is not yet released. If you are reading this on the website, then these changes are live here. -->

## 0.10.2 - 2024-04-08
### Interpreter
- Fix a bug in [`repeat ⍥`](https://uiua.org/docs/repeat) with [`infinity ∞`](https://uiua.org/docs/infinity) signature inference

## 0.10.1 - 2024-04-07
### Interpreter
- [`under ⍜`](https://uiua.org/docs/under) of pattern matching now works correctly
Expand Down
5 changes: 2 additions & 3 deletions src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,21 +361,20 @@ impl<'a> VirtualEnv<'a> {
}
} else if n.is_infinite() {
match sig.args.cmp(&sig.outputs) {
Ordering::Equal => {}
Ordering::Greater => {
return Err(SigCheckError::from(format!(
"repeat with infinity and a function with signature {sig}"
))
.loop_overreach());
}
Ordering::Less => {
Ordering::Less if self.array_stack.is_empty() => {
return Err(SigCheckError::from(format!(
"repeat with infinity and a function with signature {sig}"
))
.loop_excess());
}
_ => self.handle_sig(sig)?,
}
self.handle_sig(sig)?;
} else {
return Err("repeat without a natural number or infinity".into());
}
Expand Down
2 changes: 2 additions & 0 deletions tests/signature.ua
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ F ← |3 ⍜(↙⊙↘)⇌
F ← |3 ⍜∩°□(⊂⊂)
# Try
F ← |1 ⍣⋕∘
# Repeat
F ← |1 {⍥(⊜⧻..)∞}
# Do
C ← ⟨+1×3|÷2⟩=0◿2.
F ← |1 ◌⍢(|2 ⊂)(|1.3 ¬∊,,C⊢.)
Expand Down

0 comments on commit a8f72b3

Please sign in to comment.