diff --git a/CHANGELOG.md b/CHANGELOG.md index d1492220ee..e61ce24e8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * Lambda lifting in `while` conditions (#2038). +* Size expressions in local function parameters had an interesting + interaction with defunctionalisation (#2040). + ## [0.25.6] ### Added diff --git a/src/Futhark/Internalise/Monomorphise.hs b/src/Futhark/Internalise/Monomorphise.hs index a95c66a712..f4669b1f75 100644 --- a/src/Futhark/Internalise/Monomorphise.hs +++ b/src/Futhark/Internalise/Monomorphise.hs @@ -513,10 +513,11 @@ transformAppExp (LetFun fname (tparams, params, retdecl, Info ret, body) e loc) let (bs_local, bs_prop) = Seq.partition ((== fname) . fst) bs pure (unfoldLetFuns (map snd $ toList bs_local) e', const bs_prop) | otherwise = do - body' <- scoping (S.fromList (foldMap patNames params)) $ transformExp body - ret' <- transformRetTypeSizes (S.fromList (foldMap patNames params)) ret + params' <- mapM transformPat params + body' <- scoping (S.fromList (foldMap patNames params')) $ transformExp body + ret' <- transformRetTypeSizes (S.fromList (foldMap patNames params')) ret AppExp - <$> ( LetFun fname (tparams, params, retdecl, Info ret', body') + <$> ( LetFun fname (tparams, params', retdecl, Info ret', body') <$> scoping (S.singleton fname) (transformExp e) <*> pure loc )