diff options
author | Richard Eisenberg <eir@cis.upenn.edu> | 2016-01-14 17:48:42 -0500 |
---|---|---|
committer | Richard Eisenberg <eir@cis.upenn.edu> | 2016-01-15 15:43:45 -0500 |
commit | 3c6635ef4561ab53e51d7187c966b628a972b261 (patch) | |
tree | c3c39d7f5a54c187a965918126590584ab31d3b9 /compiler/hsSyn/HsBinds.hs | |
parent | 80b4c71c5fc8ae005f6fb73d900b225366c4d3cc (diff) | |
download | haskell-3c6635ef4561ab53e51d7187c966b628a972b261.tar.gz |
Fix #11405.
This adds a new variant of AbsBinds that is used solely for bindings
with a type signature. This allows for a simpler desugaring that
does not produce the bogus output that tripped up Core Lint in
ticket #11405. Should make other desugarings simpler, too.
Diffstat (limited to 'compiler/hsSyn/HsBinds.hs')
-rw-r--r-- | compiler/hsSyn/HsBinds.hs | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/compiler/hsSyn/HsBinds.hs b/compiler/hsSyn/HsBinds.hs index bc339873fe..b4a84d4e17 100644 --- a/compiler/hsSyn/HsBinds.hs +++ b/compiler/hsSyn/HsBinds.hs @@ -205,6 +205,20 @@ data HsBindLR idL idR abs_binds :: LHsBinds idL } + | AbsBindsSig { -- Simpler form of AbsBinds, used with a type sig + -- in tcPolyCheck. Produces simpler desugaring and + -- is necessary to avoid #11405, comment:3. + abs_tvs :: [TyVar], + abs_ev_vars :: [EvVar], + + abs_sig_export :: idL, -- like abe_poly + abs_sig_prags :: TcSpecPrags, + + abs_sig_ev_bind :: TcEvBinds, -- no list needed here + abs_sig_bind :: LHsBind idL -- always only one, and it's always a + -- FunBind + } + | PatSynBind (PatSynBind idL idR) -- ^ - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnPattern', -- 'ApiAnnotation.AnnLarrow','ApiAnnotation.AnnEqual', @@ -550,7 +564,7 @@ ppr_monobind (AbsBinds { abs_tvs = tyvars, abs_ev_vars = dictvars , abs_exports = exports, abs_binds = val_binds , abs_ev_binds = ev_binds }) = sdocWithDynFlags $ \ dflags -> - if gopt Opt_PrintTypechekerElaboration dflags then + if gopt Opt_PrintTypecheckerElaboration dflags then -- Show extra information (bug number: #10662) hang (ptext (sLit "AbsBinds") <+> brackets (interpp'SP tyvars) <+> brackets (interpp'SP dictvars)) @@ -563,6 +577,19 @@ ppr_monobind (AbsBinds { abs_tvs = tyvars, abs_ev_vars = dictvars , ptext (sLit "Evidence:") <+> ppr ev_binds ] else pprLHsBinds val_binds +ppr_monobind (AbsBindsSig { abs_tvs = tyvars + , abs_ev_vars = dictvars + , abs_sig_ev_bind = ev_bind + , abs_sig_bind = bind }) + = sdocWithDynFlags $ \ dflags -> + if gopt Opt_PrintTypecheckerElaboration dflags then + hang (text "AbsBindsSig" <+> brackets (interpp'SP tyvars) + <+> brackets (interpp'SP dictvars)) + 2 $ braces $ vcat + [ text "Bind:" <+> ppr bind + , text "Evidence:" <+> ppr ev_bind ] + else + ppr bind instance (OutputableBndr id) => Outputable (ABExport id) where ppr (ABE { abe_wrap = wrap, abe_inst_wrap = inst_wrap |