Skip to content

Commit

Permalink
Fix #2048.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Nov 28, 2023
1 parent 391a9ef commit c98120a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Fixed

* Incorrect type checking of `let` binding with explicit size
quantification, where size appears in type of body (#2048).

## [0.25.9]

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/Language/Futhark/TypeChecker/Terms.hs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ checkExp (AppExp (LetPat sizes pat e body loc) _) = do
let f x = if x == v then Just (ExpSubst e') else Nothing
pure (applySubst f body_t, [])
_ ->
unscopeType loc (patNames pat') body_t
unscopeType loc (map sizeName sizes' <> patNames pat') body_t

pure $
AppExp
Expand Down
9 changes: 9 additions & 0 deletions tests/issue2048.fut
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- ==
-- input { [1,2,3] }
-- output { 3i64 }

def f [n] (xs: [n]i32) =
let [m] (ys: [m]i32) = filter (>0) xs
in ys

entry main xs = length (f xs)

0 comments on commit c98120a

Please sign in to comment.