fix: foldlM mismatch part 2 (#11779)
This PR fixes an oversight in the initial #11772 PR. Closes #11778.
This commit is contained in:
parent
a471f005d6
commit
4d2647f9c7
4 changed files with 20 additions and 3 deletions
|
|
@ -589,8 +589,10 @@ unsafe def foldlMUnsafe {α : Type u} {β : Type v} {m : Type v → Type w} [Mon
|
|||
if start < stop then
|
||||
if stop ≤ as.size then
|
||||
fold (USize.ofNat start) (USize.ofNat stop) init
|
||||
else
|
||||
else if start < as.size then
|
||||
fold (USize.ofNat start) (USize.ofNat as.size) init
|
||||
else
|
||||
pure init
|
||||
else
|
||||
pure init
|
||||
|
||||
|
|
|
|||
|
|
@ -269,8 +269,10 @@ unsafe def foldlMUnsafe {β : Type v} {m : Type v → Type w} [Monad m] (f : β
|
|||
if start < stop then
|
||||
if stop ≤ as.size then
|
||||
fold (USize.ofNat start) (USize.ofNat stop) init
|
||||
else
|
||||
else if start < as.size then
|
||||
fold (USize.ofNat start) (USize.ofNat as.size) init
|
||||
else
|
||||
pure init
|
||||
else
|
||||
pure init
|
||||
|
||||
|
|
|
|||
|
|
@ -144,8 +144,10 @@ unsafe def foldlMUnsafe {β : Type v} {m : Type v → Type w} [Monad m] (f : β
|
|||
if start < stop then
|
||||
if stop ≤ as.size then
|
||||
fold (USize.ofNat start) (USize.ofNat stop) init
|
||||
else
|
||||
else if start < as.size then
|
||||
fold (USize.ofNat start) (USize.ofNat as.size) init
|
||||
else
|
||||
pure init
|
||||
else
|
||||
pure init
|
||||
|
||||
|
|
|
|||
11
tests/lean/run/11778.lean
Normal file
11
tests/lean/run/11778.lean
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/-- info: 0 -/
|
||||
#guard_msgs in
|
||||
#eval Array.foldl (·+·) 0 #[1,2,3] (start := 5) (stop := 10)
|
||||
|
||||
/-- info: 0 -/
|
||||
#guard_msgs in
|
||||
#eval ByteArray.foldl (·+·) 0 ⟨#[1,2,3]⟩ (start := 5) (stop := 10)
|
||||
|
||||
/-- info: 0.000000 -/
|
||||
#guard_msgs in
|
||||
#eval FloatArray.foldl (·+·) 0 ⟨#[1,2,3]⟩ (start := 5) (stop := 10)
|
||||
Loading…
Add table
Reference in a new issue