Skip to content

Commit

Permalink
[ refactor ] simplify isFreshMeta (drop unused argument)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasabel committed Jan 5, 2024
1 parent 57e4bad commit f515556
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/full/Agda/TypeChecking/Generalize.hs
Original file line number Diff line number Diff line change
Expand Up @@ -297,17 +297,19 @@ computeGeneralization genRecMeta nameMap allmetas = postponeInstanceConstraints
reportSDoc "tc.generalize" 10 $ "computing generalization for type" <+> prettyTCM genRecMeta

-- Pair metas with their metaInfo
let mvs = MapS.assocs (openMetas allmetas) ++
let mvs :: [(MetaId, MetaVariable)]
mvs = MapS.assocs (openMetas allmetas) ++
MapS.assocs (solvedMetas allmetas)

-- Issue 4727: filter out metavariables that were created before the
-- current checkpoint, since they are too old to be generalized.
-- TODO: make metasCreatedBy smarter so it doesn't see pruned
-- versions of old metas as new metas.
cp <- viewTC eCurrentCheckpoint
let isFreshMeta :: MonadReduce m => (MetaId, MetaVariable) -> m Bool
isFreshMeta (x,mv) = enterClosure mv $ \ _ -> isJust <$> checkpointSubstitution' cp
mvs <- filterM isFreshMeta mvs
let isFreshMeta :: MonadReduce m => MetaVariable -> m Bool
isFreshMeta mv = enterClosure mv $ \ _ -> isJust <$> checkpointSubstitution' cp
mvs :: [(MetaId, MetaVariable)] <- filterM (isFreshMeta . snd) mvs

cs <- (++) <$> useTC stAwakeConstraints
<*> useTC stSleepingConstraints

Expand Down Expand Up @@ -485,7 +487,7 @@ computeGeneralization genRecMeta nameMap allmetas = postponeInstanceConstraints
case mv of
Nothing -> __IMPOSSIBLE__
Just Left{} -> return False
Just (Right mv) -> isFreshMeta (m, mv)
Just (Right mv) -> isFreshMeta mv

return (genTel, telNames, sub)

Expand Down

0 comments on commit f515556

Please sign in to comment.