diff --git a/plugins/hls-tactics-plugin/src/Wingman/CodeGen.hs b/plugins/hls-tactics-plugin/src/Wingman/CodeGen.hs index ab3e266abd..57afba70e9 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/CodeGen.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/CodeGen.hs @@ -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) diff --git a/plugins/hls-tactics-plugin/src/Wingman/Tactics.hs b/plugins/hls-tactics-plugin/src/Wingman/Tactics.hs index 44e996c8c7..8805ae2c99 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/Tactics.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/Tactics.hs @@ -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 @@ -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 () diff --git a/plugins/hls-tactics-plugin/test/CodeAction/AutoSpec.hs b/plugins/hls-tactics-plugin/test/CodeAction/AutoSpec.hs index 413f33ad5c..cc97666a2a 100644 --- a/plugins/hls-tactics-plugin/test/CodeAction/AutoSpec.hs +++ b/plugins/hls-tactics-plugin/test/CodeAction/AutoSpec.hs @@ -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" diff --git a/plugins/hls-tactics-plugin/test/golden/AutoUnusedPatternMatch.expected.hs b/plugins/hls-tactics-plugin/test/golden/AutoUnusedPatternMatch.expected.hs new file mode 100644 index 0000000000..2885a1ca05 --- /dev/null +++ b/plugins/hls-tactics-plugin/test/golden/AutoUnusedPatternMatch.expected.hs @@ -0,0 +1,2 @@ +test :: Bool -> () +test _ = () diff --git a/plugins/hls-tactics-plugin/test/golden/AutoUnusedPatternMatch.hs b/plugins/hls-tactics-plugin/test/golden/AutoUnusedPatternMatch.hs new file mode 100644 index 0000000000..5345192969 --- /dev/null +++ b/plugins/hls-tactics-plugin/test/golden/AutoUnusedPatternMatch.hs @@ -0,0 +1,2 @@ +test :: Bool -> () +test = _