Skip to content

Commit 5ebda72

Browse files
committed
Infer constraints on wildcardtys as well
1 parent cc5b7f5 commit 5ebda72

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/PropR/Eval.hs

+9-6
Original file line numberDiff line numberDiff line change
@@ -633,11 +633,18 @@ moduleToProb baseCC@CompConf {tempDirBase = baseTempDir, ..} mod_path mb_target
633633
mkPropSig :: Set RdrName -> LIdP GhcPs -> LIdP GhcPs -> [Sig GhcPs]
634634
mkPropSig vars nfid ofid = prop_sig
635635
where
636+
alsoInferConstraints :: LHsType GhcPs -> LHsType GhcPs
637+
alsoInferConstraints = noLocA . HsQualTy noExtField ctx
638+
where ctx :: LHsContext GhcPs
639+
ctx = noLocA $ [noLocA $ HsWildCardTy noExtField]
640+
636641
prop_sig = case snd <$> prog_sig (unLoc ofid) of
637-
-- We don't want to wrap wildcardTys any further
642+
-- We don't want to wrap wildcardTys any further,
643+
-- but we add the constraint inference.
638644
Just (TypeSig e _ wt) ->
639645
[ TypeSig e [nfid] $ case wt of
640-
HsWC _ (L _ (HsSig _ _ (L _ (HsWildCardTy _)))) -> wt
646+
HsWC wx (L sl (HsSig sx sb t@(L _ (HsWildCardTy _)))) ->
647+
HsWC wx (L sl (HsSig sx sb $ alsoInferConstraints t))
641648
_ -> toWrapSig wt
642649
]
643650
_ -> []
@@ -647,10 +654,6 @@ moduleToProb baseCC@CompConf {tempDirBase = baseTempDir, ..} mod_path mb_target
647654
where
648655
wtys :: [HsType GhcPs]
649656
wtys = replicate (length $ filter (`Set.member` vars) targets) (HsWildCardTy NoExtField)
650-
alsoInferConstraints :: LHsType GhcPs -> LHsType GhcPs
651-
alsoInferConstraints = noLocA . HsQualTy noExtField ctx
652-
where ctx :: LHsContext GhcPs
653-
ctx = noLocA $ [noLocA $ HsWildCardTy noExtField]
654657

655658
tyApps [] = t
656659
tyApps (ty : tys) =

0 commit comments

Comments
 (0)