@@ -942,6 +942,9 @@ aiFn inpat expat ist fc f as
942 find n (g : gs) acc = find n gs (g : acc)
942 find n (g : gs) acc = find n gs (g : acc)
944-- replace non-linear occurrences with _
944-- replace non-linear occurrences with _
945+-- ASSUMPTION: This is called before adding 'alternatives' because otherwise
946+-- it is hard to get right!
945stripLinear :: IState -> PTerm -> PTerm
948stripLinear :: IState -> PTerm -> PTerm
946stripLinear i tm = evalState (sl tm) [] where
949stripLinear i tm = evalState (sl tm) [] where
947 sl :: PTerm -> State [Name] PTerm
950 sl :: PTerm -> State [Name] PTerm
@@ -949,7 +952,7 @@ stripLinear i tm = evalState (sl tm) [] where
949 | (_:_) <- lookupTy Nothing f (tt_ctxt i)
952 | (_:_) <- lookupTy Nothing f (tt_ctxt i)
950 = return $ PRef fc f
953 = return $ PRef fc f
951 | otherwise = do ns <- get
954 | otherwise = do ns <- get
952− trace (show (f, ns)) $ if (f `elem` ns)
955+ if (f `elem` ns)
953 then return Placeholder
956 then return Placeholder
954 else do put (f : ns)
957 else do put (f : ns)
955 return (PRef fc f)
958 return (PRef fc f)