diff --git a/plugins/hls-tactics-plugin/src/Wingman/Tactics.hs b/plugins/hls-tactics-plugin/src/Wingman/Tactics.hs index f477a2a323..e1fad30d46 100644 --- a/plugins/hls-tactics-plugin/src/Wingman/Tactics.hs +++ b/plugins/hls-tactics-plugin/src/Wingman/Tactics.hs @@ -298,6 +298,7 @@ destructAll = do _ -> Nothing ) $ fmap (\hi -> (hi, hi_provenance hi)) + $ filter (isAlgType . unCType . hi_type) $ unHypothesis $ jHypothesis jdg for_ args destruct diff --git a/plugins/hls-tactics-plugin/test/CodeAction/DestructAllSpec.hs b/plugins/hls-tactics-plugin/test/CodeAction/DestructAllSpec.hs index 5e5a11fe0f..afdddc08ed 100644 --- a/plugins/hls-tactics-plugin/test/CodeAction/DestructAllSpec.hs +++ b/plugins/hls-tactics-plugin/test/CodeAction/DestructAllSpec.hs @@ -38,4 +38,5 @@ spec = do destructAllTest 2 11 "DestructAllAnd.hs" destructAllTest 4 23 "DestructAllMany.hs" destructAllTest 2 18 "DestructAllNonVarTopMatch.hs" + destructAllTest 2 18 "DestructAllFunc.hs" diff --git a/plugins/hls-tactics-plugin/test/golden/DestructAllFunc.hs b/plugins/hls-tactics-plugin/test/golden/DestructAllFunc.hs new file mode 100644 index 0000000000..6996698400 --- /dev/null +++ b/plugins/hls-tactics-plugin/test/golden/DestructAllFunc.hs @@ -0,0 +1,3 @@ +has_a_func :: Bool -> (a -> b) -> Bool +has_a_func x y = _ + diff --git a/plugins/hls-tactics-plugin/test/golden/DestructAllFunc.hs.expected b/plugins/hls-tactics-plugin/test/golden/DestructAllFunc.hs.expected new file mode 100644 index 0000000000..ebc9903a7b --- /dev/null +++ b/plugins/hls-tactics-plugin/test/golden/DestructAllFunc.hs.expected @@ -0,0 +1,4 @@ +has_a_func :: Bool -> (a -> b) -> Bool +has_a_func False y = _ +has_a_func True y = _ +