summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2019-05-16 19:41:46 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-05-29 10:39:05 -0400
commitf9d61ebbf4bba7862ae53c69b0f7116423b8f6d1 (patch)
treec2f63dc9f458ff4453c42d93ca778bd0b0ddb991 /compiler
parenta5b14ad4764c5596331dd5a0abf0b0f6df6b0053 (diff)
downloadhaskell-f9d61ebbf4bba7862ae53c69b0f7116423b8f6d1.tar.gz
In hole fits, don't show VTA for inferred variables (#16456)
We fetch the ArgFlag for every argument by using splitForAllVarBndrs instead of splitForAllTys in unwrapTypeVars.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/typecheck/TcHoleErrors.hs23
1 files changed, 16 insertions, 7 deletions
diff --git a/compiler/typecheck/TcHoleErrors.hs b/compiler/typecheck/TcHoleErrors.hs
index db47450aa1..a5a4cf28d4 100644
--- a/compiler/typecheck/TcHoleErrors.hs
+++ b/compiler/typecheck/TcHoleErrors.hs
@@ -516,21 +516,30 @@ pprHoleFit (HFDC sWrp sWrpVars sTy sProv sMs) hf = hang display 2 provenance
ty = hfType hf
matches = hfMatches hf
wrap = hfWrap hf
- tyApp = sep $ map ((text "@" <>) . pprParendType) wrap
+ tyApp = sep $ zipWithEqual "pprHoleFit" pprArg vars wrap
+ where pprArg b arg = case binderArgFlag b of
+ Specified -> text "@" <> pprParendType arg
+ -- Do not print type application for inferred
+ -- variables (#16456)
+ Inferred -> empty
+ Required -> pprPanic "pprHoleFit: bad Required"
+ (ppr b <+> ppr arg)
tyAppVars = sep $ punctuate comma $
- map (\(v,t) -> ppr v <+> text "~" <+> pprParendType t) $
- zip vars wrap
+ zipWithEqual "pprHoleFit" (\v t -> ppr (binderVar v) <+>
+ text "~" <+> pprParendType t)
+ vars wrap
+
+ vars = unwrapTypeVars ty
where
- vars = unwrapTypeVars ty
-- Attempts to get all the quantified type variables in a type,
-- e.g.
- -- return :: forall (m :: * -> *) Monad m => (forall a . a) -> m a
+ -- return :: forall (m :: * -> *) Monad m => (forall a . a -> m a)
-- into [m, a]
- unwrapTypeVars :: Type -> [TyVar]
+ unwrapTypeVars :: Type -> [TyCoVarBinder]
unwrapTypeVars t = vars ++ case splitFunTy_maybe unforalled of
Just (_, unfunned) -> unwrapTypeVars unfunned
_ -> []
- where (vars, unforalled) = splitForAllTys t
+ where (vars, unforalled) = splitForAllVarBndrs t
holeVs = sep $ map (parens . (text "_" <+> dcolon <+>) . ppr) matches
holeDisp = if sMs then holeVs
else sep $ replicate (length matches) $ text "_"