@@ -79,6 +79,8 @@ small n t = termsize n t < 50
7979namesUsed :: SC -> [Name]
8080namesUsed sc = nub $ nu' [] sc where
8181 nu' ps (Case n alts) = nub (concatMap (nua ps) alts) \\ [n]
82+ nu' ps (ProjCase t alts) = nub $ (nut ps t ++
83+ (concatMap (nua ps) alts))
8284 nu' ps (STerm t) = nub $ nut ps t
8385 nu' ps _ = []
8486
@@ -89,6 +91,7 @@ namesUsed sc = nub $ nu' [] sc where
8991 nut ps (P _ n _) | n `elem` ps = []
9092 | otherwise = [n]
9193 nut ps (App f a) = nut ps f ++ nut ps a
94+ nut ps (Proj t _) = nut ps t
9295 nut ps (Bind n (Let t v) sc) = nut ps v ++ nut (n:ps) sc
9396 nut ps (Bind n b sc) = nut (n:ps) sc
9497 nut ps _ = []
@@ -100,6 +103,7 @@ namesUsed sc = nub $ nu' [] sc where
100103findCalls :: SC -> [Name] -> [(Name, [[Name]])]
101104findCalls sc topargs = nub $ nu' topargs sc where
102105 nu' ps (Case n alts) = nub (concatMap (nua (n : ps)) alts)
106+ nu' ps (ProjCase t alts) = nub (nut ps t ++ concatMap (nua ps) alts)
103107 nu' ps (STerm t) = nub $ nut ps t
104108 nu' ps _ = []
105109
@@ -115,6 +119,7 @@ findCalls sc topargs = nub $ nu' topargs sc where
115119 else [(n, map argNames args)] ++ concatMap (nut ps) args
116120 | otherwise = nut ps f ++ nut ps a
117121 nut ps (Bind n (Let t v) sc) = nut ps v ++ nut (n:ps) sc
122+ nut ps (Proj t _) = nut ps t
118123 nut ps (Bind n b sc) = nut (n:ps) sc
119124 nut ps _ = []
120125