Skip to content

Commit dc46c4e

Browse files
committed
Explicitly infer constraints
1 parent 7cf5f3d commit dc46c4e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/PropR/Check.hs

+2
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ sigForProp e_prop_sigs trans e_prop@(L _ FunBind {..}) =
286286
-- We add a within to the alternatives, so the type changes from Bool
287287
-- We make sure that we don't replace wildcard types.
288288
replLast :: LHsType GhcPs -> LHsType GhcPs
289+
replLast (L l (HsQualTy hqtx hqctxt r )) =
290+
L l $ HsQualTy hqtx hqctxt $ replLast r
289291
replLast (L l (HsFunTy noAnn arr k r)) =
290292
L l $ HsFunTy noAnn arr k $ replLast r
291293
replLast t@(L _ (HsWildCardTy _)) = t

src/PropR/Eval.hs

+6-1
Original file line numberDiff line numberDiff line change
@@ -643,10 +643,15 @@ moduleToProb baseCC@CompConf {tempDirBase = baseTempDir, ..} mod_path mb_target
643643
_ -> []
644644
toWrapSig :: LHsSigWcType GhcPs -> LHsSigWcType GhcPs
645645
toWrapSig (HsWC e (L hsl (HsSig hsx hsib t)))
646-
= HsWC e (L hsl $ HsSig hsx hsib $ tyApps wtys)
646+
= HsWC e (L hsl $ HsSig hsx hsib $ alsoInferConstraints $ tyApps wtys)
647647
where
648648
wtys :: [HsType GhcPs]
649649
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]
654+
650655
tyApps [] = t
651656
tyApps (ty : tys) =
652657
noLocA $ HsFunTy noAnn arr (noLocA ty) (tyApps tys)

0 commit comments

Comments
 (0)