Improve SimplUtils.interestingArg

There were two problems here:
- We were looking under a lambda without extending
the in-scope env, which triggered a WARNING
But there's no need to look under a lambda.

- We were looking under a letrec without extending
the in-scope env, which triggered the same WARNING
Solution: extend the in-scope env
parent 3017cbcf
 ... @@ -637,16 +637,19 @@ interestingArg env e = go env 0 e ... @@ -637,16 +637,19 @@ interestingArg env e = go env 0 e go _ _ (Type _) = TrivArg go _ _ (Type _) = TrivArg go _ _ (Coercion _) = TrivArg go _ _ (Coercion _) = TrivArg go env n (App fn (Type _)) = go env n fn go env n (App fn (Type _)) = go env n fn go env n (App fn (Coercion _)) = go env n fn go env n (App fn _) = go env (n+1) fn go env n (App fn _) = go env (n+1) fn go env n (Tick _ a) = go env n a go env n (Tick _ a) = go env n a go env n (Cast e _) = go env n e go env n (Cast e _) = go env n e go env n (Lam v e) go env n (Lam v e) | isTyVar v = go env n e | isTyVar v = go env n e | n>0 = go env (n-1) e | n>0 = NonTrivArg -- (\x.b) e is NonTriv | otherwise = ValueArg | otherwise = ValueArg go env n (Let _ e) = case go env n e of { ValueArg -> ValueArg; _ -> NonTrivArg } go _ _ (Case {}) = NonTrivArg go _ _ (Case {}) = NonTrivArg go env n (Let b e) = case go env' n e of ValueArg -> ValueArg _ -> NonTrivArg where env' = env `addNewInScopeIds` bindersOf b go_var n v go_var n v | isConLikeId v = ValueArg -- Experimenting with 'conlike' rather that | isConLikeId v = ValueArg -- Experimenting with 'conlike' rather that ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!