Skip to content

Wingman: Don't count it as using a term if you only destruct it #2099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion plugins/hls-tactics-plugin/src/Wingman/CodeGen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ destruct' use_field_puns f hi jdg = do
$ disallowing AlreadyDestructed (S.singleton term) jdg
pure $ ext
& #syn_trace %~ rose ("destruct " <> show term) . pure
& #syn_used_vals %~ S.insert term
& #syn_val %~ noLoc . case' (var' term)


Expand Down
4 changes: 2 additions & 2 deletions plugins/hls-tactics-plugin/src/Wingman/Tactics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ assume name = rule $ \jdg -> do
-- reasonable for a default value.
(pure (noLoc $ var' name))
{ syn_trace = tracePrim $ "assume " <> occNameString name
, syn_used_vals = S.singleton name
, syn_used_vals = S.singleton name <> getAncestry jdg name
}
Nothing -> cut

Expand Down Expand Up @@ -298,7 +298,7 @@ apply (Unsaturated n) hi = tracing ("apply' " <> show (hi_name hi)) $ do
) saturated_args
pure $
ext
& #syn_used_vals %~ S.insert func
& #syn_used_vals %~ (\x -> S.insert func x <> getAncestry jdg func)
& #syn_val %~ mkApply func . fmap unLoc

application :: TacticsM ()
Expand Down
1 change: 1 addition & 0 deletions plugins/hls-tactics-plugin/test/CodeAction/AutoSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ spec = do
autoTest 2 25 "AutoInfixInfix"
autoTest 19 12 "AutoTypeLevel"
autoTest 11 9 "AutoForallClassMethod"
autoTest 2 8 "AutoUnusedPatternMatch"

failing "flaky in CI" $
autoTest 2 11 "GoldenApplicativeThen"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test :: Bool -> ()
test _ = ()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test :: Bool -> ()
test = _