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
17 changes: 16 additions & 1 deletion plugins/hls-tactics-plugin/src/Wingman/CodeGen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,22 @@ buildDataCon
-> [Type] -- ^ Type arguments for the data con
-> RuleM (Synthesized (LHsExpr GhcPs))
buildDataCon should_blacklist jdg dc tyapps = do
let args = conLikeInstOrigArgTys' dc tyapps
args <- case dc of
RealDataCon dc' -> do
let (skolems', theta, args) = dataConInstSig dc' tyapps
modify $ \ts ->
evidenceToSubst (foldMap mkEvidence theta) ts
& #ts_skolems <>~ S.fromList skolems'
pure args
_ ->
-- If we have a 'PatSyn', we can't continue, since there is no
-- 'dataConInstSig' equivalent for 'PatSyn's. I don't think this is
-- a fundamental problem, but I don't know enough about the GHC internals
-- to implement it myself.
--
-- Fortunately, this isn't an issue in practice, since 'PatSyn's are
-- never in the hypothesis.
throwError $ TacticPanic "Can't build Pattern constructors yet"
ext
<- fmap unzipTrace
$ traverse ( \(arg, n) ->
Expand Down
2 changes: 2 additions & 0 deletions plugins/hls-tactics-plugin/test/CodeAction/AutoSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ spec = do
autoTest 6 10 "AutoThetaRefl"
autoTest 6 8 "AutoThetaReflDestruct"
autoTest 19 30 "AutoThetaMultipleUnification"
autoTest 16 9 "AutoThetaSplitUnification"

describe "known" $ do
autoTest 25 13 "GoldenArbitrary"
Expand All @@ -83,4 +84,5 @@ spec = do

describe "messages" $ do
mkShowMessageTest allFeatures Auto "" 2 8 "MessageForallA" TacticErrors
mkShowMessageTest allFeatures Auto "" 7 8 "MessageCantUnify" TacticErrors

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeOperators #-}

data A = A
data B = B
data X = X
data Y = Y


data Pairrow ax by where
Pairrow :: (a -> b) -> (x -> y) -> Pairrow '(a, x) '(b, y)

test2 :: (A -> B) -> (X -> Y) -> Pairrow '(A, X) '(B, Y)
test2 = Pairrow

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeOperators #-}

data A = A
data B = B
data X = X
data Y = Y


data Pairrow ax by where
Pairrow :: (a -> b) -> (x -> y) -> Pairrow '(a, x) '(b, y)

test2 :: (A -> B) -> (X -> Y) -> Pairrow '(A, X) '(B, Y)
test2 = _

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

data Z ab where
Z :: (a -> b) -> Z '(a, b)

test :: Z ab
test = _