Skip to content
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
6 changes: 2 additions & 4 deletions plugins/hls-tactics-plugin/src/Ide/Plugin/Tactic/Tactics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,9 @@ split :: TacticsM ()
split = tracing "split(user)" $ do
jdg <- goal
let g = jGoal jdg
case splitTyConApp_maybe $ unCType g of
case tacticsGetDataCons $ unCType g of
Nothing -> throwError $ GoalMismatch "split" g
Just (tc, _) -> do
let dcs = tyConDataCons tc
choice $ fmap splitDataCon dcs
Just (dcs, _) -> choice $ fmap splitDataCon dcs


------------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions plugins/hls-tactics-plugin/test/GoldenSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,12 @@ spec = do
refineTest "RefineReader.hs" 4 8
refineTest "RefineGADT.hs" 8 8

-- test via:
-- stack test hls-tactics-plugin --test-arguments '--match "Golden/golden tests/"'
describe "golden tests" $ do
let autoTest = mkGoldenTest allFeatures Auto ""

autoTest "AutoSplitGADT.hs" 11 8
goldenTest Intros "" "GoldenIntros.hs" 2 8
autoTest "GoldenEitherAuto.hs" 2 11
autoTest "GoldenJoinCont.hs" 4 12
Expand Down
12 changes: 12 additions & 0 deletions plugins/hls-tactics-plugin/test/golden/AutoSplitGADT.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{-# LANGUAGE GADTs #-}

data GADT b a where
GBool :: b -> GADT b Bool
GInt :: GADT b Int

-- wingman would prefer to use GBool since then it can use its argument. But
-- that won't unify with GADT Int, so it is forced to pick GInt and ignore the
-- argument.
test :: b -> GADT b Int
test = _

12 changes: 12 additions & 0 deletions plugins/hls-tactics-plugin/test/golden/AutoSplitGADT.hs.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{-# LANGUAGE GADTs #-}

data GADT b a where
GBool :: b -> GADT b Bool
GInt :: GADT b Int

-- wingman would prefer to use GBool since then it can use its argument. But
-- that won't unify with GADT Int, so it is forced to pick GInt and ignore the
-- argument.
test :: b -> GADT b Int
test _ = GInt