diff --git a/changelog.md b/changelog.md index 83d01a9c9..0f3e3c318 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,10 @@ Uiua is not yet stable. +## 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 diff --git a/src/check.rs b/src/check.rs index 2bf644b0e..01daab025 100644 --- a/src/check.rs +++ b/src/check.rs @@ -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()); } diff --git a/tests/signature.ua b/tests/signature.ua index f67483dd4..d421b128f 100644 --- a/tests/signature.ua +++ b/tests/signature.ua @@ -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⊢.)