diff options
42 files changed, 1213 insertions, 1186 deletions
diff --git a/compiler/typecheck/TcBinds.hs b/compiler/typecheck/TcBinds.hs index 7df495f85f..9a7ad6184a 100644 --- a/compiler/typecheck/TcBinds.hs +++ b/compiler/typecheck/TcBinds.hs @@ -34,7 +34,6 @@ import ConLike import Inst( deeplyInstantiate ) import FamInstEnv( normaliseType ) import FamInst( tcGetFamInstEnvs ) -import Type( pprSigmaTypeExtraCts ) import TyCon import TcType import TysPrim @@ -200,10 +199,11 @@ tcHsBootSigs (ValBindsOut binds sigs) = do { checkTc (null binds) badBootDeclErr ; concat <$> mapM (addLocM tc_boot_sig) (filter isTypeLSig sigs) } where - tc_boot_sig (TypeSig lnames ty _) = mapM f lnames + tc_boot_sig (TypeSig lnames hs_ty _) = mapM f lnames where - f (L _ name) = do { sigma_ty <- tcHsSigType (FunSigCtxt name True) ty - ; return (mkVanillaGlobal name sigma_ty) } + f (L _ name) + = do { sigma_ty <- tcHsSigType (FunSigCtxt name False) hs_ty + ; return (mkVanillaGlobal name sigma_ty) } -- Notice that we make GlobalIds, not LocalIds tc_boot_sig s = pprPanic "tcHsBootSigs/tc_boot_sig" (ppr s) tcHsBootSigs groups = pprPanic "tcHsBootSigs" (ppr groups) @@ -479,9 +479,9 @@ tc_single _top_lvl sig_fn _prag_fn (L _ (PatSynBind psb@PSB{ psb_id = L _ name } } where tc_pat_syn_decl = case sig_fn name of - Nothing -> tcInferPatSynDecl psb - Just (TcPatSynInfo tpsi) -> tcCheckPatSynDecl psb tpsi - Just _ -> panic "tc_single" + Nothing -> tcInferPatSynDecl psb + Just (TcPatSynSig tpsi) -> tcCheckPatSynDecl psb tpsi + Just _ -> panic "tc_single" tc_single top_lvl sig_fn prag_fn lbind thing_inside = do { (binds1, ids) <- tcPolyBinds top_lvl sig_fn prag_fn @@ -490,11 +490,6 @@ tc_single top_lvl sig_fn prag_fn lbind thing_inside ; thing <- tcExtendLetEnv top_lvl ids thing_inside ; return (binds1, thing) } --- | No signature or a partial signature -noCompleteSig :: Maybe TcSigInfo -> Bool -noCompleteSig Nothing = True -noCompleteSig (Just sig) = isPartialSig sig - ------------------------ mkEdges :: TcSigFun -> LHsBinds Name -> [Node BKey (LHsBind Name)] @@ -597,29 +592,32 @@ tcPolyNoGen rec_tc prag_fn tc_sig_fn bind_list tcPolyCheck :: RecFlag -- Whether it's recursive after breaking -- dependencies based on type signatures -> TcPragEnv - -> TcSigInfo + -> TcIdSigInfo -> LHsBind Name -> TcM (LHsBinds TcId, [TcId]) -- There is just one binding, -- it binds a single variable, -- it has a complete type signature, tcPolyCheck rec_tc prag_fn - sig@(TcSigInfo { sig_name = name, sig_poly_id = Just poly_id - , sig_tvs = tvs_w_scoped - , sig_nwcs = sig_nwcs, sig_theta = theta - , sig_tau = tau, sig_loc = loc - , sig_warn_redundant = warn_redundant }) + sig@(TISI { sig_bndr = CompleteSig poly_id + , sig_tvs = tvs_w_scoped + , sig_theta = theta + , sig_tau = tau + , sig_ctxt = ctxt + , sig_loc = loc }) bind - = ASSERT( null sig_nwcs ) -- We should be in tcPolyInfer if there are wildcards - do { ev_vars <- newEvVars theta - ; let ctxt = FunSigCtxt name warn_redundant - skol_info = SigSkol ctxt (mkPhiTy theta tau) + = do { ev_vars <- newEvVars theta + ; let skol_info = SigSkol ctxt (mkPhiTy theta tau) prag_sigs = lookupPragEnv prag_fn name tvs = map snd tvs_w_scoped + -- Find the location of the original source type sig, if + -- there is was one. This will appear in messages like + -- "type variable x is bound by .. at <loc>" + name = idName poly_id ; (ev_binds, (binds', [mono_info])) <- setSrcSpan loc $ checkConstraints skol_info tvs ev_vars $ - tcMonoBinds rec_tc (\_ -> Just sig) LetLclBndr [bind] + tcMonoBinds rec_tc (\_ -> Just (TcIdSig sig)) LetLclBndr [bind] ; spec_prags <- tcSpecPrags poly_id prag_sigs ; poly_id <- addInlinePrags poly_id prag_sigs @@ -695,7 +693,7 @@ mkExport prag_fn qtvs inferred_theta (poly_name, mb_sig, mono_id) ; (poly_id, inferred) <- case mb_sig of Nothing -> do { poly_id <- mkInferredPolyId poly_name qtvs inferred_theta mono_ty ; return (poly_id, True) } - Just sig | Just poly_id <- completeSigPolyId_maybe sig + Just sig | Just poly_id <- completeIdSigPolyId_maybe sig -> return (poly_id, False) | otherwise -> do { final_theta <- completeTheta inferred_theta sig @@ -776,13 +774,11 @@ mk_bind_msg inferred want_ambig poly_name poly_ty tidy_env -- an error message, unless the PartialTypeSignatures flag is enabled. In this -- case, the extra inferred constraints are accepted without complaining. -- Returns the annotated constraints combined with the inferred constraints. -completeTheta :: TcThetaType -> TcSigInfo -> TcM TcThetaType -completeTheta _ (TcPatSynInfo _) - = panic "Extra-constraints wildcard not supported in a pattern signature" +completeTheta :: TcThetaType -> TcIdSigInfo -> TcM TcThetaType completeTheta inferred_theta - sig@(TcSigInfo { sig_extra_cts = mb_extra_cts - , sig_theta = annotated_theta }) - | Just loc <- mb_extra_cts + (TISI { sig_bndr = s_bndr + , sig_theta = annotated_theta }) + | PartialSig { sig_cts = Just loc } <- s_bndr = do { annotated_theta <- zonkTcThetaType annotated_theta ; let inferred_diff = minusList inferred_theta annotated_theta final_theta = annotated_theta ++ inferred_diff @@ -807,7 +803,7 @@ completeTheta inferred_theta 2 (text "with inferred constraints:") <+> pprTheta inferred_diff , if suppress_hint then empty else pts_hint - , typeSigCtxt sig ] + , typeSigCtxt s_bndr ] {- Note [Partial type signatures and generalisation] @@ -902,7 +898,8 @@ recoveryCode binder_names sig_fn ; return (emptyBag, poly_ids) } where mk_dummy name - | Just (TcSigInfo { sig_poly_id = Just poly_id }) <- sig_fn name + | Just sig <- sig_fn name + , Just poly_id <- completeSigPolyId_maybe sig = poly_id | otherwise = mkLocalId name forall_a_a @@ -1086,21 +1083,23 @@ tcSpecPrag poly_id prag@(SpecSig fun_name hs_tys inl) -- However we want to use fun_name in the error message, since that is -- what the user wrote (Trac #8537) = addErrCtxt (spec_ctxt prag) $ - do { spec_tys <- mapM (tcHsSigType sig_ctxt) hs_tys - ; warnIf (not (isOverloadedTy poly_ty || isInlinePragma inl)) + do { warnIf (not (isOverloadedTy poly_ty || isInlinePragma inl)) (ptext (sLit "SPECIALISE pragma for non-overloaded function") <+> quotes (ppr fun_name)) -- Note [SPECIALISE pragmas] - - ; wraps <- mapM (tcSpecWrapper sig_ctxt poly_ty) spec_tys - ; traceTc "tcSpecPrag" (ppr poly_id $$ nest 2 (vcat (map ppr (spec_tys `zip` wraps)))) - ; return [ (SpecPrag poly_id wrap inl) | wrap <- wraps ] } + ; spec_prags <- mapM tc_one hs_tys + ; traceTc "tcSpecPrag" (ppr poly_id $$ nest 2 (vcat (map ppr spec_prags))) + ; return spec_prags } where name = idName poly_id poly_ty = idType poly_id - sig_ctxt = FunSigCtxt name True spec_ctxt prag = hang (ptext (sLit "In the SPECIALISE pragma")) 2 (ppr prag) + tc_one hs_ty + = do { spec_ty <- tcHsSigType (FunSigCtxt name False) hs_ty + ; wrap <- tcSpecWrapper (FunSigCtxt name True) poly_ty spec_ty + ; return (SpecPrag poly_id wrap inl) } + tcSpecPrag _ prag = pprPanic "tcSpecPrag" (ppr prag) -------------- @@ -1360,7 +1359,9 @@ tcMonoBinds _ sig_fn no_gen binds -- Bring the monomorphic Ids, into scope for the RHSs ; let mono_info = getMonoBindInfo tc_binds rhs_id_env = [(name, mono_id) | (name, mb_sig, mono_id) <- mono_info - , noCompleteSig mb_sig ] + , case mb_sig of + Just sig -> isPartialSig sig + Nothing -> True ] -- A monomorphic binding for each term variable that lacks -- a type sig. (Ones with a sig are already in scope.) @@ -1390,13 +1391,14 @@ data TcMonoBind -- Half completed; LHS done, RHS not done = TcFunBind MonoBindInfo SrcSpan Bool (MatchGroup Name (LHsExpr Name)) | TcPatBind [MonoBindInfo] (LPat TcId) (GRHSs Name (LHsExpr Name)) TcSigmaType -type MonoBindInfo = (Name, Maybe TcSigInfo, TcId) +type MonoBindInfo = (Name, Maybe TcIdSigInfo, TcId) -- Type signature (if any), and -- the monomorphic bound things tcLhs :: TcSigFun -> LetBndrSpec -> HsBind Name -> TcM TcMonoBind tcLhs sig_fn no_gen (FunBind { fun_id = L nm_loc name, fun_infix = inf, fun_matches = matches }) - | Just sig <- sig_fn name + | Just (TcIdSig sig) <- sig_fn name + , TISI { sig_bndr = s_bndr, sig_tau = tau } <- sig = ASSERT2( case no_gen of { LetLclBndr -> True; LetGblBndr {} -> False } , ppr name ) -- { f :: ty; f x = e } is always done via CheckGen (full signature) @@ -1404,9 +1406,12 @@ tcLhs sig_fn no_gen (FunBind { fun_id = L nm_loc name, fun_infix = inf, fun_matc -- see Note [Partial type signatures and generalisation] -- Both InferGen and CheckGen gives rise to LetLclBndr do { mono_name <- newLocalName name - ; let mono_id = mkLocalId mono_name (sig_tau sig) - ; addErrCtxt (typeSigCtxt sig) $ - emitWildcardHoleConstraints (sig_nwcs sig) + ; let mono_id = mkLocalId mono_name tau + ; case s_bndr of + PartialSig { sig_nwcs = nwcs } + -> addErrCtxt (typeSigCtxt s_bndr) $ + emitWildcardHoleConstraints nwcs + CompleteSig {} -> return () ; return (TcFunBind (name, Just sig, mono_id) nm_loc inf matches) } | otherwise @@ -1422,8 +1427,12 @@ tcLhs sig_fn no_gen (PatBind { pat_lhs = pat, pat_rhs = grhss }) -- After typechecking the pattern, look up the binder -- names, which the pattern has brought into scope. lookup_info :: Name -> TcM MonoBindInfo - lookup_info name = do { mono_id <- tcLookupId name - ; return (name, sig_fn name, mono_id) } + lookup_info name + = do { mono_id <- tcLookupId name + ; let mb_sig = case sig_fn name of + Just (TcIdSig sig) -> Just sig + _ -> Nothing + ; return (name, mb_sig, mono_id) } ; ((pat', infos), pat_ty) <- addErrCtxt (patMonoBindsCtxt pat grhss) $ tcInfer tc_pat @@ -1447,9 +1456,13 @@ tcRhs (TcFunBind info@(_, mb_sig, mono_id) loc inf matches) , bind_fvs = placeHolderNamesTc , fun_tick = [] }) } where - lexically_scoped_tvs :: Maybe TcSigInfo -> [(Name, TcTyVar)] - lexically_scoped_tvs (Just (TcSigInfo { sig_tvs = user_tvs, sig_nwcs = hole_tvs })) - = [(n, tv) | (Just n, tv) <- user_tvs] ++ hole_tvs + lexically_scoped_tvs :: Maybe TcIdSigInfo -> [(Name, TcTyVar)] + lexically_scoped_tvs (Just (TISI { sig_bndr = s_bndr, sig_tvs = user_tvs })) + = hole_tvs ++ [(n, tv) | (Just n, tv) <- user_tvs] + where + hole_tvs = case s_bndr of -- See RnBinds: Note [Scoping of named wildcards] + PartialSig { sig_nwcs = nwcs } -> nwcs + CompleteSig {} -> [] lexically_scoped_tvs _ = [] tcRhs (TcPatBind infos pat' grhss pat_ty) @@ -1589,26 +1602,27 @@ tcTySigs hs_sigs tcTySig :: LSig Name -> TcM [TcSigInfo] tcTySig (L _ (IdSig id)) = do { sig <- instTcTySigFromId id - ; return [sig] } + ; return [TcIdSig sig] } tcTySig (L loc (TypeSig names@(L _ name1 : _) hs_ty wcs)) = setSrcSpan loc $ pushTcLevelM_ $ -- When instantiating the signature, do so "one level in" -- so that they can be unified under the forall - do { -- Generate fresh meta vars for the wildcards - ; nwc_tvs <- mapM newWildcardVarMetaKind wcs - - ; sigma_ty <- tcExtendTyVarEnv nwc_tvs $ tcHsSigType (FunSigCtxt name1 False) hs_ty - - ; mapM (instTcTySig hs_ty sigma_ty (extra_cts hs_ty) (zip wcs nwc_tvs)) - (map unLoc names) } + tcWildcardBinders wcs $ \ wc_prs -> + do { sigma_ty <- tcHsSigType (FunSigCtxt name1 False) hs_ty + ; mapM (do_one wc_prs sigma_ty) names } where extra_cts (L _ (HsForAllTy _ extra _ _ _)) = extra extra_cts _ = Nothing + do_one wc_prs sigma_ty (L _ name) + = do { let ctxt = FunSigCtxt name True + ; sig <- instTcTySig ctxt hs_ty sigma_ty (extra_cts hs_ty) wc_prs name + ; return (TcIdSig sig) } + tcTySig (L loc (PatSynSig (L _ name) (_, qtvs) prov req ty)) = setSrcSpan loc $ do { traceTc "tcTySig {" $ ppr name $$ ppr qtvs $$ ppr prov $$ ppr req $$ ppr ty - ; let ctxt = FunSigCtxt name False + ; let ctxt = PatSynCtxt name ; tcHsTyVarBndrs qtvs $ \ qtvs' -> do { ty' <- tcHsSigType ctxt ty ; req' <- tcHsContext req @@ -1627,45 +1641,48 @@ tcTySig (L loc (PatSynSig (L _ name) (_, qtvs) prov req ty)) patsig_univ = univ_tvs, patsig_prov = prov', patsig_req = req' } - ; return [TcPatSynInfo tpsi] }} + ; return [TcPatSynSig tpsi] }} tcTySig _ = return [] -instTcTySigFromId :: Id -> TcM TcSigInfo +instTcTySigFromId :: Id -> TcM TcIdSigInfo +-- Used for instance methods and record selectors instTcTySigFromId id - = do { let loc = getSrcSpan id + = do { let name = idName id + loc = getSrcSpan name ; (tvs, theta, tau) <- tcInstType (tcInstSigTyVarsLoc loc) (idType id) - ; return (TcSigInfo { sig_name = idName id - , sig_poly_id = Just id, sig_loc = loc - , sig_tvs = [(Nothing, tv) | tv <- tvs] - , sig_nwcs = [] - , sig_theta = theta, sig_tau = tau - , sig_extra_cts = Nothing - , sig_warn_redundant = False - -- Do not report redundant constraints for - -- instance methods and record selectors + ; return (TISI { sig_bndr = CompleteSig id + , sig_tvs = [(Nothing, tv) | tv <- tvs] + , sig_theta = theta + , sig_tau = tau + , sig_ctxt = FunSigCtxt name False + -- Do not report redundant constraints for + -- instance methods and record selectors + , sig_loc = loc }) } -instTcTySig :: LHsType Name -> TcType -- HsType and corresponding TcType +instTcTySig :: UserTypeCtxt + -> LHsType Name + -> TcType -> Maybe SrcSpan -- Just loc <=> an extra-constraints -- wildcard is present at location loc. -> [(Name, TcTyVar)] -- Named wildcards -> Name -- Name of the function - -> TcM TcSigInfo -instTcTySig hs_ty@(L loc _) sigma_ty extra_cts nwcs name + -> TcM TcIdSigInfo +instTcTySig ctxt hs_ty sigma_ty extra_cts nwcs name = do { (inst_tvs, theta, tau) <- tcInstType tcInstSigTyVars sigma_ty - ; let mb_poly_id | isNothing extra_cts && null nwcs - = Just $ mkLocalId name sigma_ty -- non-partial - | otherwise = Nothing -- partial type signature - ; return (TcSigInfo { sig_name = name - , sig_poly_id = mb_poly_id - , sig_loc = loc - , sig_tvs = findScopedTyVars hs_ty sigma_ty inst_tvs - , sig_nwcs = nwcs - , sig_theta = theta, sig_tau = tau - , sig_extra_cts = extra_cts - , sig_warn_redundant = True + ; let bndr | isNothing extra_cts && null nwcs + = CompleteSig (mkLocalId name sigma_ty) + | otherwise + = PartialSig { sig_name = name, sig_nwcs = nwcs + , sig_cts = extra_cts, sig_hs_ty = hs_ty } + ; return (TISI { sig_bndr = bndr + , sig_tvs = findScopedTyVars hs_ty sigma_ty inst_tvs + , sig_theta = theta + , sig_tau = tau + , sig_ctxt = ctxt + , sig_loc = getLoc hs_ty -- SrcSpan from the signature }) } ------------------------------- @@ -1675,7 +1692,7 @@ data GeneralisationPlan | InferGen -- Implicit generalisation; there is an AbsBinds Bool -- True <=> apply the MR; generalise only unconstrained type vars - | CheckGen (LHsBind Name) TcSigInfo + | CheckGen (LHsBind Name) TcIdSigInfo -- One binding with a signature -- Explicit generalisation; there is an AbsBinds @@ -1744,7 +1761,7 @@ decideGeneralisationPlan dflags type_env bndr_names lbinds sig_fn -- except a single function binding with a signature one_funbind_with_sig | [lbind@(L _ (FunBind { fun_id = v }))] <- lbinds - , Just sig <- sig_fn (unLoc v) + , Just (TcIdSig sig) <- sig_fn (unLoc v) = Just (lbind, sig) | otherwise = Nothing @@ -1873,12 +1890,10 @@ patMonoBindsCtxt :: (OutputableBndr id, Outputable body) => LPat id -> GRHSs Nam patMonoBindsCtxt pat grhss = hang (ptext (sLit "In a pattern binding:")) 2 (pprPatBind pat grhss) -typeSigCtxt :: TcSigInfo -> SDoc -typeSigCtxt (TcPatSynInfo _) - = panic "Should only be called with a TcSigInfo" -typeSigCtxt (TcSigInfo { sig_name = name, sig_tvs = tvs - , sig_theta = theta, sig_tau = tau - , sig_extra_cts = extra_cts }) - = sep [ text "In" <+> pprUserTypeCtxt (FunSigCtxt name False) <> colon - , nest 2 (pprSigmaTypeExtraCts (isJust extra_cts) - (mkSigmaTy (map snd tvs) theta tau)) ] +typeSigCtxt :: TcIdSigBndr -> SDoc +typeSigCtxt (PartialSig { sig_name = n, sig_hs_ty = hs_ty }) + = vcat [ ptext (sLit "In the type signature for:") + , nest 2 (pprPrefixOcc n <+> dcolon <+> ppr hs_ty) ] +typeSigCtxt (CompleteSig id) + = vcat [ ptext (sLit "In the type signature for:") + , nest 2 (pprPrefixOcc id <+> dcolon <+> ppr (idType id)) ] diff --git a/compiler/typecheck/TcClassDcl.hs b/compiler/typecheck/TcClassDcl.hs index e868da2638..bb4159a4be 100644 --- a/compiler/typecheck/TcClassDcl.hs +++ b/compiler/typecheck/TcClassDcl.hs @@ -9,7 +9,7 @@ Typechecking class declarations {-# LANGUAGE CPP #-} module TcClassDcl ( tcClassSigs, tcClassDecl2, - findMethodBind, instantiateMethod, + findMethodBind, instantiateMethod, tcClassMinimalDef, HsSigFun, mkHsSigFun, lookupHsSig, emptyHsSigs, tcMkDeclCtxt, tcAddDeclCtxt, badMethodErr @@ -19,7 +19,7 @@ module TcClassDcl ( tcClassSigs, tcClassDecl2, import HsSyn import TcEnv -import TcPat( addInlinePrags, completeSigPolyId, lookupPragEnv, emptyPragEnv ) +import TcPat( addInlinePrags, completeIdSigPolyId, lookupPragEnv, emptyPragEnv ) import TcEvidence( idHsWrapper ) import TcBinds import TcUnify @@ -207,8 +207,8 @@ tcDefMeth clas tyvars this_dict binds_in (ptext (sLit "Ignoring SPECIALISE pragmas on default method") <+> quotes (ppr sel_name)) - ; let hs_ty = lookupHsSig hs_sig_fn sel_name - `orElse` pprPanic "tc_dm" (ppr sel_name) + ; let hs_ty = lookupHsSig hs_sig_fn sel_name + `orElse` pprPanic "tc_dm" (ppr sel_name) -- We need the HsType so that we can bring the right -- type variables into scope -- @@ -225,18 +225,19 @@ tcDefMeth clas tyvars this_dict binds_in -- Substitute the local_meth_name for the binder -- NB: the binding is always a FunBind - ; local_dm_sig <- instTcTySig hs_ty local_dm_ty Nothing [] local_dm_name - ; let local_dm_sig' = local_dm_sig { sig_warn_redundant = warn_redundant } + ctxt = FunSigCtxt sel_name warn_redundant + + ; local_dm_sig <- instTcTySig ctxt hs_ty local_dm_ty Nothing [] local_dm_name ; (ev_binds, (tc_bind, _)) <- checkConstraints (ClsSkol clas) tyvars [this_dict] $ - tcPolyCheck NonRecursive no_prag_fn local_dm_sig' + tcPolyCheck NonRecursive no_prag_fn local_dm_sig (L bind_loc lm_bind) ; let export = ABE { abe_poly = global_dm_id -- We have created a complete type signature in -- instTcTySig, hence it is safe to call -- completeSigPolyId - , abe_mono = completeSigPolyId local_dm_sig' + , abe_mono = completeIdSigPolyId local_dm_sig , abe_wrap = idHsWrapper , abe_prags = IsDefaultMethod } full_bind = AbsBinds { abs_tvs = tyvars diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 9f4cb4d473..9694305b24 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -1701,7 +1701,7 @@ quickFlattenTy (TyConApp tc tys) | otherwise = do { let (funtys,resttys) = splitAt (tyConArity tc) tys -- Ignore the arguments of the type family funtys - ; v <- newMetaTyVar (TauTv False) (typeKind (TyConApp tc funtys)) + ; v <- newMetaTyVar TauTv (typeKind (TyConApp tc funtys)) ; flat_resttys <- mapM quickFlattenTy resttys ; return (foldl AppTy (mkTyVarTy v) flat_resttys) } diff --git a/compiler/typecheck/TcExpr.hs b/compiler/typecheck/TcExpr.hs index 605ba57089..d2b0c59244 100644 --- a/compiler/typecheck/TcExpr.hs +++ b/compiler/typecheck/TcExpr.hs @@ -218,9 +218,10 @@ tcExpr e@(HsLamCase _ matches) res_ty match_ctxt = MC { mc_what = CaseAlt, mc_body = tcBody } tcExpr (ExprWithTySig expr sig_ty wcs) res_ty - = do { nwc_tvs <- mapM newWildcardVarMetaKind wcs - ; tcExtendTyVarEnv nwc_tvs $ do { - sig_tc_ty <- tcHsSigType ExprSigCtxt sig_ty + = tcWildcardBinders wcs $ \ wc_prs -> + do { addErrCtxt (pprSigCtxt ExprSigCtxt empty (ppr sig_ty)) $ + emitWildcardHoleConstraints wc_prs + ; sig_tc_ty <- tcHsSigType ExprSigCtxt sig_ty ; (gen_fn, expr') <- tcGen ExprSigCtxt sig_tc_ty $ \ skol_tvs res_ty -> @@ -234,9 +235,7 @@ tcExpr (ExprWithTySig expr sig_ty wcs) res_ty ; let inner_expr = ExprWithTySigOut (mkLHsWrap gen_fn expr') sig_ty ; (inst_wrap, rho) <- deeplyInstantiate ExprSigOrigin sig_tc_ty - ; addErrCtxt (pprSigCtxt ExprSigCtxt empty (ppr sig_ty)) $ - emitWildcardHoleConstraints (zip wcs nwc_tvs) - ; tcWrapResult (mkHsWrap inst_wrap inner_expr) rho res_ty } } + ; tcWrapResult (mkHsWrap inst_wrap inner_expr) rho res_ty } tcExpr (HsType ty) _ = failWithTc (text "Can't handle type argument:" <+> ppr ty) diff --git a/compiler/typecheck/TcHsType.hs b/compiler/typecheck/TcHsType.hs index 53c023410c..605929efbe 100644 --- a/compiler/typecheck/TcHsType.hs +++ b/compiler/typecheck/TcHsType.hs @@ -19,6 +19,7 @@ module TcHsType ( -- Kind-checking types -- No kind generalisation, no checkValidType + tcWildcardBinders, kcHsTyVarBndrs, tcHsTyVarBndrs, tcHsLiftedType, tcHsOpenType, tcLHsType, tcCheckLHsType, tcCheckLHsTypeAndGen, @@ -922,6 +923,19 @@ addTypeCtxt (L _ ty) thing ************************************************************************ -} +tcWildcardBinders :: [Name] + -> ([(Name,TcTyVar)] -> TcM a) + -> TcM a +tcWildcardBinders wcs thing_inside + = do { wc_prs <- mapM new_wildcard wcs + ; tcExtendTyVarEnv2 wc_prs $ + thing_inside wc_prs } + where + new_wildcard :: Name -> TcM (Name, TcTyVar) + new_wildcard name = do { kind <- newMetaKindVar + ; tv <- newFlexiTyVar kind + ; return (name, tv) } + mkKindSigVar :: Name -> TcM KindVar -- Use the specified name; don't clone it mkKindSigVar n @@ -1266,16 +1280,15 @@ tcHsPatSigType :: UserTypeCtxt tcHsPatSigType ctxt (HsWB { hswb_cts = hs_ty, hswb_kvs = sig_kvs, hswb_tvs = sig_tvs, hswb_wcs = sig_wcs }) = addErrCtxt (pprSigCtxt ctxt empty (ppr hs_ty)) $ - do { kvs <- mapM new_kv sig_kvs + tcWildcardBinders sig_wcs $ \ nwc_binds -> + do { emitWildcardHoleConstraints nwc_binds + ; kvs <- mapM new_kv sig_kvs ; tvs <- mapM new_tv sig_tvs - ; nwc_tvs <- mapM newWildcardVarMetaKind sig_wcs - ; let nwc_binds = sig_wcs `zip` nwc_tvs - ktv_binds = (sig_kvs `zip` kvs) ++ (sig_tvs `zip` tvs) - ; sig_ty <- tcExtendTyVarEnv2 (ktv_binds ++ nwc_binds) $ + ; let ktv_binds = (sig_kvs `zip` kvs) ++ (sig_tvs `zip` tvs) + ; sig_ty <- tcExtendTyVarEnv2 ktv_binds $ tcHsLiftedType hs_ty ; sig_ty <- zonkSigType sig_ty ; checkValidType ctxt sig_ty - ; emitWildcardHoleConstraints (zip sig_wcs nwc_tvs) ; return (sig_ty, ktv_binds, nwc_binds) } where new_kv name = new_tkv name superKind diff --git a/compiler/typecheck/TcInstDcls.hs b/compiler/typecheck/TcInstDcls.hs index f1aa3c580e..461eb5a2e8 100644 --- a/compiler/typecheck/TcInstDcls.hs +++ b/compiler/typecheck/TcInstDcls.hs @@ -18,7 +18,7 @@ import TcTyClsDecls import TcClassDcl( tcClassDecl2, HsSigFun, lookupHsSig, mkHsSigFun, findMethodBind, instantiateMethod ) -import TcPat ( addInlinePrags, completeSigPolyId, lookupPragEnv, emptyPragEnv ) +import TcPat ( TcIdSigInfo, addInlinePrags, completeIdSigPolyId, lookupPragEnv, emptyPragEnv ) import TcRnMonad import TcValidity import TcMType @@ -1328,8 +1328,8 @@ tcMethods dfun_id clas tyvars dfun_ev_vars inst_tys HsVar dm_id -- A method always has a complete type signature, - -- hence it is safe to call completeSigPolyId - local_meth_id = completeSigPolyId local_meth_sig + -- hence it is safe to call completeIdSigPolyId + local_meth_id = completeIdSigPolyId local_meth_sig meth_bind = mkVarBind local_meth_id (L inst_loc rhs) meth_id1 = meth_id `setInlinePragma` dm_inline_prag -- Copy the inline pragma (if any) from the default @@ -1377,9 +1377,9 @@ tcMethodBody clas tyvars dfun_ev_vars inst_tys inst_tys sel_id ; let prags = lookupPragEnv prag_fn (idName sel_id) - -- A method always has a complete type signature, hence - -- it is safe to call completeSigPolyId - local_meth_id = completeSigPolyId local_meth_sig + -- A method always has a complete type signature, + -- so it is safe to call cmpleteIdSigPolyId + local_meth_id = completeIdSigPolyId local_meth_sig lm_bind = meth_bind { fun_id = L bndr_loc (idName local_meth_id) } -- Substitute the local_meth_name for the binder -- NB: the binding is always a FunBind @@ -1419,7 +1419,7 @@ tcMethodBody clas tyvars dfun_ev_vars inst_tys ------------------------ mkMethIds :: HsSigFun -> Class -> [TcTyVar] -> [EvVar] - -> [TcType] -> Id -> TcM (TcId, TcSigInfo, HsWrapper) + -> [TcType] -> Id -> TcM (TcId, TcIdSigInfo, HsWrapper) mkMethIds sig_fn clas tyvars dfun_ev_vars inst_tys sel_id = do { poly_meth_name <- newName (mkClassOpAuxOcc sel_occ) ; local_meth_name <- newName sel_occ @@ -1434,11 +1434,12 @@ mkMethIds sig_fn clas tyvars dfun_ev_vars inst_tys sel_id -> setSrcSpan (getLoc lhs_ty) $ do { inst_sigs <- xoptM Opt_InstanceSigs ; checkTc inst_sigs (misplacedInstSig sel_name lhs_ty) - ; sig_ty <- tcHsSigType (FunSigCtxt sel_name True) lhs_ty + ; sig_ty <- tcHsSigType (FunSigCtxt sel_name False) lhs_ty ; let poly_sig_ty = mkSigmaTy tyvars theta sig_ty - ; tc_sig <- instTcTySig lhs_ty sig_ty Nothing [] local_meth_name + ctxt = FunSigCtxt sel_name True + ; tc_sig <- instTcTySig ctxt lhs_ty sig_ty Nothing [] local_meth_name ; hs_wrap <- addErrCtxtM (methSigCtxt sel_name poly_sig_ty poly_meth_ty) $ - tcSubType (FunSigCtxt sel_name False) poly_sig_ty poly_meth_ty + tcSubType ctxt poly_sig_ty poly_meth_ty ; return (poly_meth_id, tc_sig, hs_wrap) } Nothing -- No type signature diff --git a/compiler/typecheck/TcMType.hs b/compiler/typecheck/TcMType.hs index 326e4bb0ec..455c9566c9 100644 --- a/compiler/typecheck/TcMType.hs +++ b/compiler/typecheck/TcMType.hs @@ -54,11 +54,7 @@ module TcMType ( zonkTcKind, defaultKindVarToStar, zonkEvVar, zonkWC, zonkSimples, zonkId, zonkCt, zonkSkolemInfo, - tcGetGlobalTyVars, - - -------------------------------- - -- (Named) Wildcards - newWildcardVar, newWildcardVarMetaKind + tcGetGlobalTyVars ) where #include "HsVersions.h" @@ -104,7 +100,7 @@ kind_var_occ = mkOccName tvName "k" newMetaKindVar :: TcM TcKind newMetaKindVar = do { uniq <- newUnique - ; details <- newMetaDetails (TauTv False) + ; details <- newMetaDetails TauTv ; let kv = mkTcTyVar (mkKindName uniq) superKind details ; return (mkTyVarTy kv) } @@ -288,19 +284,12 @@ newMetaTyVar meta_info kind ; let name = mkTcTyVarName uniq s s = case meta_info of ReturnTv -> fsLit "r" - TauTv True -> fsLit "w" - TauTv False -> fsLit "t" + TauTv -> fsLit "t" FlatMetaTv -> fsLit "fmv" SigTv -> fsLit "a" ; details <- newMetaDetails meta_info ; return (mkTcTyVar name kind details) } -newNamedMetaTyVar :: Name -> MetaInfo -> Kind -> TcM TcTyVar --- Make a new meta tyvar out of thin air -newNamedMetaTyVar name meta_info kind - = do { details <- newMetaDetails meta_info - ; return (mkTcTyVar name kind details) } - newSigTyVar :: Name -> Kind -> TcM TcTyVar newSigTyVar name kind = do { uniq <- newUnique @@ -418,7 +407,7 @@ writeMetaTyVarRef tyvar ref ty -} newFlexiTyVar :: Kind -> TcM TcTyVar -newFlexiTyVar kind = newMetaTyVar (TauTv False) kind +newFlexiTyVar kind = newMetaTyVar TauTv kind newFlexiTyVarTy :: Kind -> TcM TcType newFlexiTyVarTy kind = do @@ -449,7 +438,7 @@ tcInstTyVarX :: TvSubst -> TKVar -> TcM (TvSubst, TcTyVar) -- an existing TyVar. We substitute kind variables in the kind. tcInstTyVarX subst tyvar = do { uniq <- newUnique - ; details <- newMetaDetails (TauTv False) + ; details <- newMetaDetails TauTv ; let name = mkSystemName uniq (getOccName tyvar) -- See Note [Name of an instantiated type variable] kind = substTy subst (tyVarKind tyvar) @@ -577,22 +566,13 @@ skolemiseUnboundMetaTyVar tv details ; uniq <- newUnique -- Remove it from TcMetaTyVar unique land ; kind <- zonkTcKind (tyVarKind tv) ; let tv_name = getOccName tv - new_tv_name = if isWildcardVar tv - then generaliseWildcardVarName tv_name - else tv_name - final_name = mkInternalName uniq new_tv_name span + final_name = mkInternalName uniq tv_name span final_kind = defaultKind kind final_tv = mkTcTyVar final_name final_kind details ; traceTc "Skolemising" (ppr tv <+> ptext (sLit ":=") <+> ppr final_tv) ; writeMetaTyVar tv (mkTyVarTy final_tv) ; return final_tv } - where - -- If a wildcard type called _a is generalised, we rename it to w_a - generaliseWildcardVarName :: OccName -> OccName - generaliseWildcardVarName name | startsWithUnderscore name - = mkOccNameFS (occNameSpace name) (appendFS (fsLit "w") (occNameFS name)) - generaliseWildcardVarName name = name {- Note [Zonking to Skolem] @@ -969,31 +949,3 @@ tidySkolemInfo env (UnifyForAllSkol skol_tvs ty) ty' = tidyType env2 ty tidySkolemInfo env info = (env, info) - -{- -************************************************************************ -* * - (Named) Wildcards -* * -************************************************************************ --} - --- | Create a new meta var with the given kind. This meta var should be used --- to replace a wildcard in a type. Such a wildcard meta var can be --- distinguished from other meta vars with the 'isWildcardVar' function. -newWildcardVar :: Name -> Kind -> TcM TcTyVar -newWildcardVar name kind = newNamedMetaTyVar name (TauTv True) kind - --- | Create a new meta var (which can unify with a type of any kind). This --- meta var should be used to replace a wildcard in a type. Such a wildcard --- meta var can be distinguished from other meta vars with the 'isWildcardVar' --- function. -newWildcardVarMetaKind :: Name -> TcM TcTyVar -newWildcardVarMetaKind name = do kind <- newMetaKindVar - newWildcardVar name kind - --- | Return 'True' if the argument is a meta var created for a wildcard (by --- 'newWildcardVar' or 'newWildcardVarMetaKind'). -isWildcardVar :: TcTyVar -> Bool -isWildcardVar tv | isTcTyVar tv, MetaTv (TauTv True) _ _ <- tcTyVarDetails tv = True -isWildcardVar _ = False diff --git a/compiler/typecheck/TcPat.hs b/compiler/typecheck/TcPat.hs index bec80ca5e2..17d044176f 100644 --- a/compiler/typecheck/TcPat.hs +++ b/compiler/typecheck/TcPat.hs @@ -10,9 +10,9 @@ TcPat: Typechecking patterns module TcPat ( tcLetPat, TcSigFun , TcPragEnv, lookupPragEnv, emptyPragEnv - , TcSigInfo(..), TcPatSynInfo(..) - , findScopedTyVars, isPartialSig - , completeSigPolyId, completeSigPolyId_maybe + , TcSigInfo(..), TcIdSigInfo(..), TcPatSynInfo(..), TcIdSigBndr(..) + , findScopedTyVars, isPartialSig, noCompleteSig + , completeIdSigPolyId, completeSigPolyId_maybe, completeIdSigPolyId_maybe , LetBndrSpec(..), addInlinePrags , tcPat, tcPats, newNoSigLetBndr , addDataConStupidTheta, badFieldCon, polyPatSig ) where @@ -145,56 +145,43 @@ emptyPragEnv = emptyNameEnv lookupPragEnv :: TcPragEnv -> Name -> [LSig Name] lookupPragEnv prag_fn n = lookupNameEnv prag_fn n `orElse` [] -data TcSigInfo - = TcSigInfo { - sig_name :: Name, -- The binder name of the type signature. When - -- sig_id = Just id, then sig_name = idName id. +data TcSigInfo = TcIdSig TcIdSigInfo + | TcPatSynSig TcPatSynInfo - sig_poly_id :: Maybe TcId, - -- Just f <=> the type signature had no wildcards, so the precise, - -- complete polymorphic type is known. In that case, - -- f is the polymorphic Id, with that type - - -- Nothing <=> the type signature is partial (i.e. includes one or more - -- wildcards). In this case it doesn't make sense to give - -- the polymorphic Id, because we are going to /infer/ its - -- type, so we can't make the polymorphic Id ab-initio - -- - -- See Note [Complete and partial type signatures] +data TcIdSigInfo + = TISI { + sig_bndr :: TcIdSigBndr, sig_tvs :: [(Maybe Name, TcTyVar)], -- Instantiated type and kind variables -- Just n <=> this skolem is lexically in scope with name n -- See Note [Binding scoped type variables] - sig_nwcs :: [(Name, TcTyVar)], - -- Instantiated wildcard variables - -- If sig_poly_id = Just f, then sig_nwcs must be empty - - sig_extra_cts :: Maybe SrcSpan, - -- Just loc <=> An extra-constraints wildcard was present - -- at location loc - -- e.g. f :: (Eq a, _) => a -> a - -- Any extra constraints inferred during - -- type-checking will be added to the sig_theta. - -- If sig_poly_id = Just f, sig_extra_cts must be Nothing - sig_theta :: TcThetaType, -- Instantiated theta sig_tau :: TcSigmaType, -- Instantiated tau -- See Note [sig_tau may be polymorphic] - sig_loc :: SrcSpan, -- The location of the signature - - sig_warn_redundant :: Bool -- True <=> report redundant constraints - -- when typechecking the value binding - -- for this type signature - -- This is usually True, but False for - -- * Record selectors (not important here) - -- * Class and instance methods. Here the code may legitimately - -- be more polymorphic than the signature generated from the - -- class declaration + sig_ctxt :: UserTypeCtxt, -- FunSigCtxt or CheckSigCtxt + sig_loc :: SrcSpan -- Location of the type signature } - | TcPatSynInfo TcPatSynInfo + +data TcIdSigBndr -- See Note [Complete and partial type signatures] + = CompleteSig -- A complete signature with no wildards, + -- so the complete polymorphic type is known. + TcId -- The polymoprhic Id with that type + + | PartialSig -- A partial type signature (i.e. includes one or more + -- wildcards). In this case it doesn't make sense to give + -- the polymorphic Id, because we are going to /infer/ its + -- type, so we can't make the polymorphic Id ab-initio + { sig_name :: Name -- Name of the function + , sig_hs_ty :: LHsType Name -- The original partial signatur + , sig_nwcs :: [(Name, TcTyVar)] -- Instantiated wildcard variables + , sig_cts :: Maybe SrcSpan -- Just loc <=> An extra-constraints wildcard was present + } -- at location loc + -- e.g. f :: (Eq a, _) => a -> a + -- Any extra constraints inferred during + -- type-checking will be added to the sig_theta. data TcPatSynInfo = TPSI { @@ -224,35 +211,56 @@ findScopedTyVars hs_ty sig_ty inst_tvs scoped_names = mkNameSet (hsExplicitTvs hs_ty) (sig_tvs,_) = tcSplitForAllTys sig_ty -instance NamedThing TcSigInfo where - getName TcSigInfo{ sig_name = name } = name - getName (TcPatSynInfo tpsi) = patsig_name tpsi +instance NamedThing TcIdSigInfo where + getName (TISI { sig_bndr = bndr }) = getName bndr +instance NamedThing TcIdSigBndr where + getName (CompleteSig id) = idName id + getName (PartialSig { sig_name = n }) = n + +instance NamedThing TcSigInfo where + getName (TcIdSig idsi) = getName idsi + getName (TcPatSynSig tpsi) = patsig_name tpsi instance Outputable TcSigInfo where - ppr (TcSigInfo { sig_name = name, sig_poly_id = mb_poly_id, sig_tvs = tyvars - , sig_theta = theta, sig_tau = tau }) - = maybe (ppr name) ppr mb_poly_id <+> dcolon <+> + ppr (TcIdSig idsi) = ppr idsi + ppr (TcPatSynSig tpsi) = text "TcPatSynInfo" <+> ppr tpsi + +instance Outputable TcIdSigInfo where + ppr (TISI { sig_bndr = bndr, sig_tvs = tyvars + , sig_theta = theta, sig_tau = tau }) + = ppr bndr <+> dcolon <+> vcat [ pprSigmaType (mkSigmaTy (map snd tyvars) theta tau) , ppr (map fst tyvars) ] - ppr (TcPatSynInfo tpsi) = text "TcPatSynInfo" <+> ppr tpsi + +instance Outputable TcIdSigBndr where + ppr s_bndr = ppr (getName s_bndr) instance Outputable TcPatSynInfo where ppr (TPSI{ patsig_name = name}) = ppr name -isPartialSig :: TcSigInfo -> Bool -isPartialSig (TcSigInfo { sig_poly_id = Nothing }) = True -isPartialSig _ = False +isPartialSig :: TcIdSigInfo -> Bool +isPartialSig (TISI { sig_bndr = PartialSig {} }) = True +isPartialSig _ = False + +-- | No signature or a partial signature +noCompleteSig :: Maybe TcSigInfo -> Bool +noCompleteSig (Just (TcIdSig sig)) = isPartialSig sig +noCompleteSig _ = True -- Helper for cases when we know for sure we have a complete type -- signature, e.g. class methods. -completeSigPolyId :: TcSigInfo -> TcId -completeSigPolyId (TcSigInfo { sig_poly_id = Just id }) = id -completeSigPolyId _ = panic "completeSigPolyId" +completeIdSigPolyId :: TcIdSigInfo -> TcId +completeIdSigPolyId (TISI { sig_bndr = CompleteSig id }) = id +completeIdSigPolyId _ = panic "completeSigPolyId" + +completeIdSigPolyId_maybe :: TcIdSigInfo -> Maybe TcId +completeIdSigPolyId_maybe (TISI { sig_bndr = CompleteSig id }) = Just id +completeIdSigPolyId_maybe _ = Nothing completeSigPolyId_maybe :: TcSigInfo -> Maybe TcId -completeSigPolyId_maybe (TcSigInfo { sig_poly_id = mb_id }) = mb_id -completeSigPolyId_maybe (TcPatSynInfo {}) = Nothing +completeSigPolyId_maybe (TcIdSig sig) = completeIdSigPolyId_maybe sig +completeSigPolyId_maybe (TcPatSynSig {}) = Nothing {- Note [Binding scoped type variables] @@ -314,7 +322,7 @@ A type signature is partial when it contains one or more wildcards stored in sig_nwcs. f :: Bool -> _ g :: Eq _a => _a -> _a -> Bool -* Or an extra-constraints wildcard, stored in sig_extra_cts: +* Or an extra-constraints wildcard, stored in sig_cts: h :: (Num a, _) => a -> a A type signature is a complete type signature when there are no @@ -334,9 +342,9 @@ tcPatBndr :: PatEnv -> Name -> TcSigmaType -> TcM (TcCoercion, TcId) -- tcPatBndr (PE { pe_ctxt = LetPat lookup_sig no_gen}) bndr_name pat_ty -- See Note [Typing patterns in pattern bindings] - | LetGblBndr prags <- no_gen - , Just sig <- lookup_sig bndr_name - , Just poly_id <- sig_poly_id sig + | LetGblBndr prags <- no_gen + , Just (TcIdSig sig) <- lookup_sig bndr_name + , Just poly_id <- completeIdSigPolyId_maybe sig = do { bndr_id <- addInlinePrags poly_id (lookupPragEnv prags bndr_name) ; traceTc "tcPatBndr(gbl,sig)" (ppr bndr_id $$ ppr (idType bndr_id)) ; co <- unifyPatType (idType bndr_id) pat_ty diff --git a/compiler/typecheck/TcPatSyn.hs b/compiler/typecheck/TcPatSyn.hs index eb2872bfdc..b4bc78205c 100644 --- a/compiler/typecheck/TcPatSyn.hs +++ b/compiler/typecheck/TcPatSyn.hs @@ -76,7 +76,7 @@ tcInferPatSynDecl PSB{ psb_id = lname@(L loc name), psb_args = details, ; let named_taus = (name, pat_ty) : map (\arg -> (getName arg, varType arg)) args - ; (qtvs, req_dicts, _mr_bites, ev_binds) <- simplifyInfer tclvl False named_taus wanted + ; (qtvs, req_dicts, _mr_bites, ev_binds) <- simplifyInfer tclvl False [] named_taus wanted ; (ex_vars, prov_dicts) <- tcCollectEx lpat' ; let univ_tvs = filter (not . (`elemVarSet` ex_vars)) qtvs @@ -119,7 +119,7 @@ tcCheckPatSynDecl PSB{ psb_id = lname@(L loc name), psb_args = details, ; req_dicts <- newEvVars req_theta -- TODO: find a better SkolInfo - ; let skol_info = SigSkol (FunSigCtxt name True) (mkFunTys arg_tys pat_ty) + ; let skol_info = SigSkol (PatSynCtxt name) (mkFunTys arg_tys pat_ty) ; let (arg_names, is_infix) = case details of PrefixPatSyn names -> (map unLoc names, False) diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs index 010a67940f..4cfa449a88 100644 --- a/compiler/typecheck/TcRnDriver.hs +++ b/compiler/typecheck/TcRnDriver.hs @@ -1846,8 +1846,7 @@ tcRnType hsc_env normalise rdr_type -- Now kind-check the type -- It can have any rank or kind - ; nwc_tvs <- mapM newWildcardVarMetaKind wcs - ; (ty, kind) <- tcExtendTyVarEnv nwc_tvs $ + ; (ty, kind) <- tcWildcardBinders wcs $ \_ -> tcLHsType rn_type -- Do kind generalisation; see Note [Kind-generalise in tcRnType] diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs index 1f984e4f9a..83dc81b1ed 100644 --- a/compiler/typecheck/TcRnTypes.hs +++ b/compiler/typecheck/TcRnTypes.hs @@ -2149,8 +2149,8 @@ pprSigSkolInfo ctxt ty _ -> hang (pprUserTypeCtxt ctxt <> colon) 2 (ppr ty) where - pp_sig f = sep [ ptext (sLit "the type signature for:") - , pprPrefixOcc f <+> dcolon <+> ppr ty ] + pp_sig f = vcat [ ptext (sLit "the type signature for:") + , nest 2 (pprPrefixOcc f <+> dcolon <+> ppr ty) ] pprPatSkolInfo :: ConLike -> SDoc pprPatSkolInfo (RealDataCon dc) diff --git a/compiler/typecheck/TcSMonad.hs b/compiler/typecheck/TcSMonad.hs index 8c0d2f98f5..cd3d3c977b 100644 --- a/compiler/typecheck/TcSMonad.hs +++ b/compiler/typecheck/TcSMonad.hs @@ -2650,7 +2650,7 @@ instFlexiTcS tvs = wrapTcS (mapAccumLM inst_one emptyTvSubst tvs) instFlexiTcSHelper :: Name -> Kind -> TcM TcType instFlexiTcSHelper tvname kind = do { uniq <- TcM.newUnique - ; details <- TcM.newMetaDetails (TauTv False) + ; details <- TcM.newMetaDetails TauTv ; let name = setNameUnique tvname uniq ; return (mkTyVarTy (mkTcTyVar name kind details)) } diff --git a/compiler/typecheck/TcType.hs b/compiler/typecheck/TcType.hs index de9e13ec62..3a25a39b4c 100644 --- a/compiler/typecheck/TcType.hs +++ b/compiler/typecheck/TcType.hs @@ -346,11 +346,9 @@ instance Outputable MetaDetails where ppr (Indirect ty) = ptext (sLit "Indirect") <+> ppr ty data MetaInfo - = TauTv Bool -- This MetaTv is an ordinary unification variable + = TauTv -- This MetaTv is an ordinary unification variable -- A TauTv is always filled in with a tau-type, which -- never contains any ForAlls. - -- The boolean is true when the meta var originates - -- from a wildcard. | ReturnTv -- Can unify with *anything*. Used to convert a -- type "checking" algorithm into a type inference algorithm. @@ -372,16 +370,25 @@ data MetaInfo -- in the places where we need to an expression has that type data UserTypeCtxt - = FunSigCtxt Name Bool -- Function type signature, when checking the type - -- Also used for types in SPECIALISE pragmas - -- Bool = True <=> report redundant class constraints - -- False <=> do not - -- See Note [Tracking redundant constraints] in TcSimplify + = FunSigCtxt -- Function type signature, when checking the type + -- Also used for types in SPECIALISE pragmas + Name -- Name of the function + Bool -- True <=> report redundant constraints + -- This is usually True, but False for + -- * Record selectors (not important here) + -- * Class and instance methods. Here + -- the code may legitimately be more + -- polymorphic than the signature + -- generated from the class + -- declaration | InfSigCtxt Name -- Inferred type for function | ExprSigCtxt -- Expression type signature + | ConArgCtxt Name -- Data constructor argument | TySynCtxt Name -- RHS of a type synonym decl + | PatSynCtxt Name -- Type sig for a pattern synonym + -- eg pattern C :: Int -> T | PatSigCtxt -- Type sig in pattern -- eg f (x::t) = ... -- or (x::t, y) = e @@ -530,11 +537,10 @@ pprTcTyVarDetails (MetaTv { mtv_info = info, mtv_tclvl = tclvl }) = pp_info <> colon <> ppr tclvl where pp_info = case info of - ReturnTv -> ptext (sLit "ret") - TauTv True -> ptext (sLit "twc") - TauTv False -> ptext (sLit "tau") - SigTv -> ptext (sLit "sig") - FlatMetaTv -> ptext (sLit "fuv") + ReturnTv -> ptext (sLit "ret") + TauTv -> ptext (sLit "tau") + SigTv -> ptext (sLit "sig") + FlatMetaTv -> ptext (sLit "fuv") pprUserTypeCtxt :: UserTypeCtxt -> SDoc pprUserTypeCtxt (FunSigCtxt n _) = ptext (sLit "the type signature for") <+> quotes (ppr n) @@ -543,6 +549,7 @@ pprUserTypeCtxt (RuleSigCtxt n) = ptext (sLit "a RULE for") <+> quotes (ppr n) pprUserTypeCtxt ExprSigCtxt = ptext (sLit "an expression type signature") pprUserTypeCtxt (ConArgCtxt c) = ptext (sLit "the type of the constructor") <+> quotes (ppr c) pprUserTypeCtxt (TySynCtxt c) = ptext (sLit "the RHS of the type synonym") <+> quotes (ppr c) +pprUserTypeCtxt (PatSynCtxt c) = ptext (sLit "the type signature for pattern synonym") <+> quotes (ppr c) pprUserTypeCtxt ThBrackCtxt = ptext (sLit "a Template Haskell quotation [t|...|]") pprUserTypeCtxt PatSigCtxt = ptext (sLit "a pattern type signature") pprUserTypeCtxt ResSigCtxt = ptext (sLit "a result type signature") @@ -568,6 +575,7 @@ pprSigCtxt ctxt extra pp_ty pp_sig (FunSigCtxt n _) = pp_n_colon n pp_sig (ConArgCtxt n) = pp_n_colon n pp_sig (ForSigCtxt n) = pp_n_colon n + pp_sig (PatSynCtxt n) = pp_n_colon n pp_sig _ = pp_ty pp_n_colon n = pprPrefixOcc n <+> dcolon <+> pp_ty @@ -1265,7 +1273,7 @@ canUnifyWithPolyType dflags details kind = case details of MetaTv { mtv_info = ReturnTv } -> True -- See Note [ReturnTv] MetaTv { mtv_info = SigTv } -> False - MetaTv { mtv_info = TauTv _ } -> xopt Opt_ImpredicativeTypes dflags + MetaTv { mtv_info = TauTv } -> xopt Opt_ImpredicativeTypes dflags || isOpenTypeKind kind -- Note [OpenTypeKind accepts foralls] _other -> True diff --git a/compiler/typecheck/TcValidity.hs b/compiler/typecheck/TcValidity.hs index 67d75175b9..122b286243 100644 --- a/compiler/typecheck/TcValidity.hs +++ b/compiler/typecheck/TcValidity.hs @@ -282,10 +282,10 @@ checkValidType ctxt ty RuleSigCtxt _ -> rank1 TySynCtxt _ -> rank0 - ExprSigCtxt -> rank1 - FunSigCtxt _ _ -> rank1 - InfSigCtxt _ -> ArbitraryRank -- Inferred type - ConArgCtxt _ -> rank1 -- We are given the type of the entire + ExprSigCtxt -> rank1 + FunSigCtxt {} -> rank1 + InfSigCtxt _ -> ArbitraryRank -- Inferred type + ConArgCtxt _ -> rank1 -- We are given the type of the entire -- constructor, hence rank 1 ForSigCtxt _ -> rank1 @@ -739,6 +739,7 @@ okIPCtxt ThBrackCtxt = True okIPCtxt GhciCtxt = True okIPCtxt SigmaCtxt = True okIPCtxt (DataTyCtxt {}) = True +okIPCtxt (PatSynCtxt {}) = True okIPCtxt (ClassSCCtxt {}) = False okIPCtxt (InstDeclCtxt {}) = False diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index 74cc667782..1ee53ba582 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -131,7 +131,7 @@ module Type ( pprTvBndr, pprTvBndrs, pprForAll, pprUserForAll, pprSigmaType, pprTheta, pprThetaArrowTy, pprClassPred, pprKind, pprParendKind, pprSourceTyCon, - TyPrec(..), maybeParen, pprSigmaTypeExtraCts, + TyPrec(..), maybeParen, -- * Tidying type related things up for printing tidyType, tidyTypes, diff --git a/compiler/types/TypeRep.hs b/compiler/types/TypeRep.hs index b37ca62d59..e2be8a0ec4 100644 --- a/compiler/types/TypeRep.hs +++ b/compiler/types/TypeRep.hs @@ -32,7 +32,7 @@ module TypeRep ( -- Pretty-printing pprType, pprParendType, pprTypeApp, pprTvBndr, pprTvBndrs, - pprTyThing, pprTyThingCategory, pprSigmaType, pprSigmaTypeExtraCts, + pprTyThing, pprTyThingCategory, pprSigmaType, pprTheta, pprForAll, pprUserForAll, pprThetaArrowTy, pprClassPred, pprKind, pprParendKind, pprTyLit, suppressKinds, @@ -562,10 +562,6 @@ pprThetaArrowTy preds = parens (fsep (punctuate comma (map (ppr_type TopPrec) p -- Eq j, Eq k, Eq l) => -- Eq (a, b, c, d, e, f, g, h, i, j, k, l) -pprThetaArrowTyExtra :: ThetaType -> SDoc -pprThetaArrowTyExtra [] = text "_" <+> darrow -pprThetaArrowTyExtra preds = parens (fsep (punctuate comma xs)) <+> darrow - where xs = (map (ppr_type TopPrec) preds) ++ [text "_"] ------------------ instance Outputable Type where ppr ty = pprType ty @@ -599,7 +595,7 @@ ppr_type p fun_ty@(FunTy ty1 ty2) ppr_forall_type :: TyPrec -> Type -> SDoc ppr_forall_type p ty - = maybeParen p FunPrec $ ppr_sigma_type True False ty + = maybeParen p FunPrec $ ppr_sigma_type True ty -- True <=> we always print the foralls on *nested* quantifiers -- Opt_PrintExplicitForalls only affects top-level quantifiers -- False <=> we don't print an extra-constraints wildcard @@ -615,16 +611,14 @@ ppr_tylit _ tl = StrTyLit s -> text (show s) ------------------- -ppr_sigma_type :: Bool -> Bool -> Type -> SDoc +ppr_sigma_type :: Bool -> Type -> SDoc -- First Bool <=> Show the foralls unconditionally -- Second Bool <=> Show an extra-constraints wildcard -ppr_sigma_type show_foralls_unconditionally extra_cts ty +ppr_sigma_type show_foralls_unconditionally ty = sep [ if show_foralls_unconditionally then pprForAll tvs else pprUserForAll tvs - , if extra_cts - then pprThetaArrowTyExtra ctxt - else pprThetaArrowTy ctxt + , pprThetaArrowTy ctxt , pprType tau ] where (tvs, rho) = split1 [] ty @@ -637,10 +631,7 @@ ppr_sigma_type show_foralls_unconditionally extra_cts ty split2 ps ty = (reverse ps, ty) pprSigmaType :: Type -> SDoc -pprSigmaType ty = ppr_sigma_type False False ty - -pprSigmaTypeExtraCts :: Bool -> Type -> SDoc -pprSigmaTypeExtraCts = ppr_sigma_type False +pprSigmaType ty = ppr_sigma_type False ty pprUserForAll :: [TyVar] -> SDoc -- Print a user-level forall; see Note [When to print foralls] diff --git a/testsuite/tests/ghci/scripts/Defer02.stderr b/testsuite/tests/ghci/scripts/Defer02.stderr index 4a92236b38..cc5ae21d20 100644 --- a/testsuite/tests/ghci/scripts/Defer02.stderr +++ b/testsuite/tests/ghci/scripts/Defer02.stderr @@ -1,189 +1,193 @@ - -../../typecheck/should_run/Defer01.hs:11:40: warning: - Couldn't match type ‘Char’ with ‘[Char]’ - Expected type: String - Actual type: Char - In the first argument of ‘putStr’, namely ‘','’ - In the second argument of ‘(>>)’, namely ‘putStr ','’ - In the expression: putStr "Hello World" >> putStr ',' - -../../typecheck/should_run/Defer01.hs:14:5: warning: - Couldn't match expected type ‘Int’ with actual type ‘Char’ - In the expression: 'p' - In an equation for ‘a’: a = 'p' - -../../typecheck/should_run/Defer01.hs:18:9: warning: - No instance for (Eq B) arising from a use of ‘==’ - In the expression: x == x - In an equation for ‘b’: b x = x == x - -../../typecheck/should_run/Defer01.hs:25:4: warning: - Couldn't match type ‘Int’ with ‘Bool’ - Inaccessible code in - a pattern with constructor: C2 :: Bool -> C Bool, - in an equation for ‘c’ - In the pattern: C2 x - In an equation for ‘c’: c (C2 x) = True - -../../typecheck/should_run/Defer01.hs:28:5: warning: - No instance for (Num (a -> a)) arising from the literal ‘1’ - (maybe you haven't applied a function to enough arguments?) - In the expression: 1 - In an equation for ‘d’: d = 1 - -../../typecheck/should_run/Defer01.hs:31:5: warning: - Couldn't match expected type ‘Char -> t’ with actual type ‘Char’ - Relevant bindings include - f :: t (bound at ../../typecheck/should_run/Defer01.hs:31:1) - The function ‘e’ is applied to one argument, - but its type ‘Char’ has none - In the expression: e 'q' - In an equation for ‘f’: f = e 'q' - -../../typecheck/should_run/Defer01.hs:34:8: warning: - Couldn't match expected type ‘Char’ with actual type ‘a’ - ‘a’ is a rigid type variable bound by - the type signature for: h :: a -> (Char, Char) - at ../../typecheck/should_run/Defer01.hs:33:6 - Relevant bindings include - x :: a (bound at ../../typecheck/should_run/Defer01.hs:34:3) - h :: a -> (Char, Char) - (bound at ../../typecheck/should_run/Defer01.hs:34:1) - In the expression: x - In the expression: (x, 'c') - -../../typecheck/should_run/Defer01.hs:39:17: warning: - Couldn't match expected type ‘Bool’ with actual type ‘T a’ - Relevant bindings include - a :: a (bound at ../../typecheck/should_run/Defer01.hs:39:3) - i :: a -> () (bound at ../../typecheck/should_run/Defer01.hs:39:1) - In the first argument of ‘not’, namely ‘(K a)’ - In the expression: (not (K a)) - -../../typecheck/should_run/Defer01.hs:43:5: warning: - No instance for (MyClass a1) arising from a use of ‘myOp’ - In the expression: myOp 23 - In an equation for ‘j’: j = myOp 23 - -../../typecheck/should_run/Defer01.hs:43:10: warning: - No instance for (Num a1) arising from the literal ‘23’ - The type variable ‘a1’ is ambiguous - Note: there are several potential instances: - instance Num Integer -- Defined in ‘GHC.Num’ - instance Num Double -- Defined in ‘GHC.Float’ - instance Num Float -- Defined in ‘GHC.Float’ - ...plus two others - In the first argument of ‘myOp’, namely ‘23’ - In the expression: myOp 23 - In an equation for ‘j’: j = myOp 23 - -../../typecheck/should_run/Defer01.hs:45:6: warning: - Couldn't match type ‘Int’ with ‘Bool’ - Inaccessible code in - the type signature for: k :: (Int ~ Bool) => Int -> Bool - In the ambiguity check for the type signature for ‘k’: - k :: (Int ~ Bool) => Int -> Bool - To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - In the type signature for ‘k’: k :: (Int ~ Bool) => Int -> Bool - -../../typecheck/should_run/Defer01.hs:45:6: warning: - Couldn't match expected type ‘Bool’ with actual type ‘Int’ - In the ambiguity check for the type signature for ‘k’: - k :: (Int ~ Bool) => Int -> Bool - To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - In the type signature for ‘k’: k :: (Int ~ Bool) => Int -> Bool - -../../typecheck/should_run/Defer01.hs:45:6: warning: - Couldn't match type ‘Int’ with ‘Bool’ - Inaccessible code in - the type signature for: k :: (Int ~ Bool) => Int -> Bool - -../../typecheck/should_run/Defer01.hs:46:7: warning: - Couldn't match expected type ‘Bool’ with actual type ‘Int’ - In the expression: x - In an equation for ‘k’: k x = x - -../../typecheck/should_run/Defer01.hs:49:5: warning: - Couldn't match expected type ‘IO a0’ - with actual type ‘Char -> IO ()’ - Probable cause: ‘putChar’ is applied to too few arguments - In the first argument of ‘(>>)’, namely ‘putChar’ - In the expression: putChar >> putChar 'p' -*** Exception: ../../typecheck/should_run/Defer01.hs:11:40: error: - Couldn't match type ‘Char’ with ‘[Char]’ - Expected type: String - Actual type: Char - In the first argument of ‘putStr’, namely ‘','’ - In the second argument of ‘(>>)’, namely ‘putStr ','’ - In the expression: putStr "Hello World" >> putStr ',' -(deferred type error) -*** Exception: ../../typecheck/should_run/Defer01.hs:14:5: error: - Couldn't match expected type ‘Int’ with actual type ‘Char’ - In the expression: 'p' - In an equation for ‘a’: a = 'p' -(deferred type error) -*** Exception: ../../typecheck/should_run/Defer01.hs:18:9: error: - No instance for (Eq B) arising from a use of ‘==’ - In the expression: x == x - In an equation for ‘b’: b x = x == x -(deferred type error) - -<interactive>:7:11: error: - Couldn't match type ‘Bool’ with ‘Int’ - Expected type: C Int - Actual type: C Bool - In the first argument of ‘c’, namely ‘(C2 True)’ - In the first argument of ‘print’, namely ‘(c (C2 True))’ -*** Exception: ../../typecheck/should_run/Defer01.hs:28:5: error: - No instance for (Num (a -> a)) arising from the literal ‘1’ - (maybe you haven't applied a function to enough arguments?) - In the expression: 1 - In an equation for ‘d’: d = 1 -(deferred type error) -*** Exception: ../../typecheck/should_run/Defer01.hs:31:5: error: - Couldn't match expected type ‘Char -> t’ with actual type ‘Char’ - Relevant bindings include - f :: t (bound at ../../typecheck/should_run/Defer01.hs:31:1) - The function ‘e’ is applied to one argument, - but its type ‘Char’ has none - In the expression: e 'q' - In an equation for ‘f’: f = e 'q' -(deferred type error) -*** Exception: ../../typecheck/should_run/Defer01.hs:34:8: error: - Couldn't match expected type ‘Char’ with actual type ‘a’ - ‘a’ is a rigid type variable bound by - the type signature for: h :: a -> (Char, Char) - at ../../typecheck/should_run/Defer01.hs:33:6 - Relevant bindings include - x :: a (bound at ../../typecheck/should_run/Defer01.hs:34:3) - h :: a -> (Char, Char) - (bound at ../../typecheck/should_run/Defer01.hs:34:1) - In the expression: x - In the expression: (x, 'c') -(deferred type error) -*** Exception: ../../typecheck/should_run/Defer01.hs:39:17: error: - Couldn't match expected type ‘Bool’ with actual type ‘T a’ - Relevant bindings include - a :: a (bound at ../../typecheck/should_run/Defer01.hs:39:3) - i :: a -> () (bound at ../../typecheck/should_run/Defer01.hs:39:1) - In the first argument of ‘not’, namely ‘(K a)’ - In the expression: (not (K a)) -(deferred type error) -*** Exception: ../../typecheck/should_run/Defer01.hs:43:5: error: - No instance for (MyClass a1) arising from a use of ‘myOp’ - In the expression: myOp 23 - In an equation for ‘j’: j = myOp 23 -(deferred type error) - -<interactive>:13:8: error: - Couldn't match expected type ‘Bool’ with actual type ‘Int’ - In the first argument of ‘print’, namely ‘(k 2)’ - In the expression: print (k 2) - In an equation for ‘it’: it = print (k 2) -*** Exception: ../../typecheck/should_run/Defer01.hs:49:5: error: - Couldn't match expected type ‘IO a0’ - with actual type ‘Char -> IO ()’ - Probable cause: ‘putChar’ is applied to too few arguments - In the first argument of ‘(>>)’, namely ‘putChar’ - In the expression: putChar >> putChar 'p' -(deferred type error) +
+..\..\typecheck\should_run\Defer01.hs:11:40: warning:
+ Couldn't match type ‘Char’ with ‘[Char]’
+ Expected type: String
+ Actual type: Char
+ In the first argument of ‘putStr’, namely ‘','’
+ In the second argument of ‘(>>)’, namely ‘putStr ','’
+ In the expression: putStr "Hello World" >> putStr ','
+
+..\..\typecheck\should_run\Defer01.hs:14:5: warning:
+ Couldn't match expected type ‘Int’ with actual type ‘Char’
+ In the expression: 'p'
+ In an equation for ‘a’: a = 'p'
+
+..\..\typecheck\should_run\Defer01.hs:18:9: warning:
+ No instance for (Eq B) arising from a use of ‘==’
+ In the expression: x == x
+ In an equation for ‘b’: b x = x == x
+
+..\..\typecheck\should_run\Defer01.hs:25:4: warning:
+ Couldn't match type ‘Int’ with ‘Bool’
+ Inaccessible code in
+ a pattern with constructor: C2 :: Bool -> C Bool,
+ in an equation for ‘c’
+ In the pattern: C2 x
+ In an equation for ‘c’: c (C2 x) = True
+
+..\..\typecheck\should_run\Defer01.hs:28:5: warning:
+ No instance for (Num (a -> a)) arising from the literal ‘1’
+ (maybe you haven't applied a function to enough arguments?)
+ In the expression: 1
+ In an equation for ‘d’: d = 1
+
+..\..\typecheck\should_run\Defer01.hs:31:5: warning:
+ Couldn't match expected type ‘Char -> t’ with actual type ‘Char’
+ Relevant bindings include
+ f :: t (bound at ..\..\typecheck\should_run\Defer01.hs:31:1)
+ The function ‘e’ is applied to one argument,
+ but its type ‘Char’ has none
+ In the expression: e 'q'
+ In an equation for ‘f’: f = e 'q'
+
+..\..\typecheck\should_run\Defer01.hs:34:8: warning:
+ Couldn't match expected type ‘Char’ with actual type ‘a’
+ ‘a’ is a rigid type variable bound by
+ the type signature for:
+ h :: a -> (Char, Char)
+ at ..\..\typecheck\should_run\Defer01.hs:33:6
+ Relevant bindings include
+ x :: a (bound at ..\..\typecheck\should_run\Defer01.hs:34:3)
+ h :: a -> (Char, Char)
+ (bound at ..\..\typecheck\should_run\Defer01.hs:34:1)
+ In the expression: x
+ In the expression: (x, 'c')
+
+..\..\typecheck\should_run\Defer01.hs:39:17: warning:
+ Couldn't match expected type ‘Bool’ with actual type ‘T a’
+ Relevant bindings include
+ a :: a (bound at ..\..\typecheck\should_run\Defer01.hs:39:3)
+ i :: a -> () (bound at ..\..\typecheck\should_run\Defer01.hs:39:1)
+ In the first argument of ‘not’, namely ‘(K a)’
+ In the expression: (not (K a))
+
+..\..\typecheck\should_run\Defer01.hs:43:5: warning:
+ No instance for (MyClass a1) arising from a use of ‘myOp’
+ In the expression: myOp 23
+ In an equation for ‘j’: j = myOp 23
+
+..\..\typecheck\should_run\Defer01.hs:43:10: warning:
+ No instance for (Num a1) arising from the literal ‘23’
+ The type variable ‘a1’ is ambiguous
+ Note: there are several potential instances:
+ instance Num Integer -- Defined in ‘GHC.Num’
+ instance Num Double -- Defined in ‘GHC.Float’
+ instance Num Float -- Defined in ‘GHC.Float’
+ ...plus two others
+ In the first argument of ‘myOp’, namely ‘23’
+ In the expression: myOp 23
+ In an equation for ‘j’: j = myOp 23
+
+..\..\typecheck\should_run\Defer01.hs:45:6: warning:
+ Couldn't match type ‘Int’ with ‘Bool’
+ Inaccessible code in
+ the type signature for:
+ k :: (Int ~ Bool) => Int -> Bool
+ In the ambiguity check for the type signature for ‘k’:
+ k :: (Int ~ Bool) => Int -> Bool
+ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
+ In the type signature for ‘k’: k :: (Int ~ Bool) => Int -> Bool
+
+..\..\typecheck\should_run\Defer01.hs:45:6: warning:
+ Couldn't match expected type ‘Bool’ with actual type ‘Int’
+ In the ambiguity check for the type signature for ‘k’:
+ k :: (Int ~ Bool) => Int -> Bool
+ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
+ In the type signature for ‘k’: k :: (Int ~ Bool) => Int -> Bool
+
+..\..\typecheck\should_run\Defer01.hs:45:6: warning:
+ Couldn't match type ‘Int’ with ‘Bool’
+ Inaccessible code in
+ the type signature for:
+ k :: (Int ~ Bool) => Int -> Bool
+
+..\..\typecheck\should_run\Defer01.hs:46:7: warning:
+ Couldn't match expected type ‘Bool’ with actual type ‘Int’
+ In the expression: x
+ In an equation for ‘k’: k x = x
+
+..\..\typecheck\should_run\Defer01.hs:49:5: warning:
+ Couldn't match expected type ‘IO a0’
+ with actual type ‘Char -> IO ()’
+ Probable cause: ‘putChar’ is applied to too few arguments
+ In the first argument of ‘(>>)’, namely ‘putChar’
+ In the expression: putChar >> putChar 'p'
+*** Exception: ..\..\typecheck\should_run\Defer01.hs:11:40: error:
+ Couldn't match type ‘Char’ with ‘[Char]’
+ Expected type: String
+ Actual type: Char
+ In the first argument of ‘putStr’, namely ‘','’
+ In the second argument of ‘(>>)’, namely ‘putStr ','’
+ In the expression: putStr "Hello World" >> putStr ','
+(deferred type error)
+*** Exception: ..\..\typecheck\should_run\Defer01.hs:14:5: error:
+ Couldn't match expected type ‘Int’ with actual type ‘Char’
+ In the expression: 'p'
+ In an equation for ‘a’: a = 'p'
+(deferred type error)
+*** Exception: ..\..\typecheck\should_run\Defer01.hs:18:9: error:
+ No instance for (Eq B) arising from a use of ‘==’
+ In the expression: x == x
+ In an equation for ‘b’: b x = x == x
+(deferred type error)
+
+<interactive>:7:11: error:
+ Couldn't match type ‘Bool’ with ‘Int’
+ Expected type: C Int
+ Actual type: C Bool
+ In the first argument of ‘c’, namely ‘(C2 True)’
+ In the first argument of ‘print’, namely ‘(c (C2 True))’
+*** Exception: ..\..\typecheck\should_run\Defer01.hs:28:5: error:
+ No instance for (Num (a -> a)) arising from the literal ‘1’
+ (maybe you haven't applied a function to enough arguments?)
+ In the expression: 1
+ In an equation for ‘d’: d = 1
+(deferred type error)
+*** Exception: ..\..\typecheck\should_run\Defer01.hs:31:5: error:
+ Couldn't match expected type ‘Char -> t’ with actual type ‘Char’
+ Relevant bindings include
+ f :: t (bound at ..\..\typecheck\should_run\Defer01.hs:31:1)
+ The function ‘e’ is applied to one argument,
+ but its type ‘Char’ has none
+ In the expression: e 'q'
+ In an equation for ‘f’: f = e 'q'
+(deferred type error)
+*** Exception: ..\..\typecheck\should_run\Defer01.hs:34:8: error:
+ Couldn't match expected type ‘Char’ with actual type ‘a’
+ ‘a’ is a rigid type variable bound by
+ the type signature for:
+ h :: a -> (Char, Char)
+ at ..\..\typecheck\should_run\Defer01.hs:33:6
+ Relevant bindings include
+ x :: a (bound at ..\..\typecheck\should_run\Defer01.hs:34:3)
+ h :: a -> (Char, Char)
+ (bound at ..\..\typecheck\should_run\Defer01.hs:34:1)
+ In the expression: x
+ In the expression: (x, 'c')
+(deferred type error)
+*** Exception: ..\..\typecheck\should_run\Defer01.hs:39:17: error:
+ Couldn't match expected type ‘Bool’ with actual type ‘T a’
+ Relevant bindings include
+ a :: a (bound at ..\..\typecheck\should_run\Defer01.hs:39:3)
+ i :: a -> () (bound at ..\..\typecheck\should_run\Defer01.hs:39:1)
+ In the first argument of ‘not’, namely ‘(K a)’
+ In the expression: (not (K a))
+(deferred type error)
+*** Exception: ..\..\typecheck\should_run\Defer01.hs:43:5: error:
+ No instance for (MyClass a1) arising from a use of ‘myOp’
+ In the expression: myOp 23
+ In an equation for ‘j’: j = myOp 23
+(deferred type error)
+
+<interactive>:13:8: error:
+ Couldn't match expected type ‘Bool’ with actual type ‘Int’
+ In the first argument of ‘print’, namely ‘(k 2)’
+ In the expression: print (k 2)
+ In an equation for ‘it’: it = print (k 2)
+*** Exception: ..\..\typecheck\should_run\Defer01.hs:49:5: error:
+ Couldn't match expected type ‘IO a0’
+ with actual type ‘Char -> IO ()’
+ Probable cause: ‘putChar’ is applied to too few arguments
+ In the first argument of ‘(>>)’, namely ‘putChar’
+ In the expression: putChar >> putChar 'p'
+(deferred type error)
diff --git a/testsuite/tests/partial-sigs/should_compile/Defaulting2MROff.stderr b/testsuite/tests/partial-sigs/should_compile/Defaulting2MROff.stderr index cf7cd3ed76..fe4fcaab1d 100644 --- a/testsuite/tests/partial-sigs/should_compile/Defaulting2MROff.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Defaulting2MROff.stderr @@ -1,7 +1,7 @@ -TYPE SIGNATURES - bravo :: forall w_. Num w_ => w_ -TYPE CONSTRUCTORS -COERCION AXIOMS -Dependent modules: [] -Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0, - integer-gmp-1.0.0.0] +TYPE SIGNATURES
+ bravo :: forall t. Num t => t
+TYPE CONSTRUCTORS
+COERCION AXIOMS
+Dependent modules: []
+Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0,
+ integer-gmp-1.0.0.0]
diff --git a/testsuite/tests/partial-sigs/should_compile/Either.stderr b/testsuite/tests/partial-sigs/should_compile/Either.stderr index 59ff75cc76..23eb0275f1 100644 --- a/testsuite/tests/partial-sigs/should_compile/Either.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Either.stderr @@ -1,7 +1,7 @@ -TYPE SIGNATURES - barry :: forall w_a. w_a -> (Either [Char] w_a, Either [Char] w_a) -TYPE CONSTRUCTORS -COERCION AXIOMS -Dependent modules: [] -Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0, - integer-gmp-1.0.0.0] +TYPE SIGNATURES
+ barry :: forall t. t -> (Either [Char] t, Either [Char] t)
+TYPE CONSTRUCTORS
+COERCION AXIOMS
+Dependent modules: []
+Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0,
+ integer-gmp-1.0.0.0]
diff --git a/testsuite/tests/partial-sigs/should_compile/EveryNamed.stderr b/testsuite/tests/partial-sigs/should_compile/EveryNamed.stderr index 0d3dd7befe..b42edf58ef 100644 --- a/testsuite/tests/partial-sigs/should_compile/EveryNamed.stderr +++ b/testsuite/tests/partial-sigs/should_compile/EveryNamed.stderr @@ -1,7 +1,7 @@ -TYPE SIGNATURES - every :: forall w_a. (w_a -> Bool) -> [w_a] -> Bool -TYPE CONSTRUCTORS -COERCION AXIOMS -Dependent modules: [] -Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0, - integer-gmp-1.0.0.0] +TYPE SIGNATURES
+ every :: forall t. (t -> Bool) -> [t] -> Bool
+TYPE CONSTRUCTORS
+COERCION AXIOMS
+Dependent modules: []
+Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0,
+ integer-gmp-1.0.0.0]
diff --git a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr index 0edc8157e7..8799acd45b 100644 --- a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr @@ -1,231 +1,231 @@ -TYPE SIGNATURES - !! :: forall a. [a] -> Int -> a - $ :: forall a b. (a -> b) -> a -> b - $! :: forall a b. (a -> b) -> a -> b - && :: Bool -> Bool -> Bool - * :: forall a. Num a => a -> a -> a - ** :: forall a. Floating a => a -> a -> a - + :: forall a. Num a => a -> a -> a - ++ :: forall a. [a] -> [a] -> [a] - - :: forall a. Num a => a -> a -> a - . :: forall b c a. (b -> c) -> (a -> b) -> a -> c - / :: forall a. Fractional a => a -> a -> a - /= :: forall a. Eq a => a -> a -> Bool - < :: forall a. Ord a => a -> a -> Bool - <= :: forall a. Ord a => a -> a -> Bool - =<< :: - forall a (m :: * -> *) b. Monad m => (a -> m b) -> m a -> m b - == :: forall a. Eq a => a -> a -> Bool - > :: forall a. Ord a => a -> a -> Bool - >= :: forall a. Ord a => a -> a -> Bool - >> :: forall (m :: * -> *) a b. Monad m => m a -> m b -> m b - >>= :: - forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b - ^ :: forall a b. (Integral b, Num a) => a -> b -> a - ^^ :: forall a b. (Fractional a, Integral b) => a -> b -> a - abs :: forall a. Num a => a -> a - acos :: forall a. Floating a => a -> a - acosh :: forall a. Floating a => a -> a - all :: - forall a (t :: * -> *). Foldable t => (a -> Bool) -> t a -> Bool - and :: forall (t :: * -> *). Foldable t => t Bool -> Bool - any :: - forall a (t :: * -> *). Foldable t => (a -> Bool) -> t a -> Bool - appendFile :: FilePath -> String -> IO () - asTypeOf :: forall a. a -> a -> a - asin :: forall a. Floating a => a -> a - asinh :: forall a. Floating a => a -> a - atan :: forall a. Floating a => a -> a - atan2 :: forall a. RealFloat a => a -> a -> a - atanh :: forall a. Floating a => a -> a - break :: forall a. (a -> Bool) -> [a] -> ([a], [a]) - ceiling :: forall a b. (Integral b, RealFrac a) => a -> b - compare :: forall a. Ord a => a -> a -> Ordering - concat :: forall (t :: * -> *) a. Foldable t => t [a] -> [a] - concatMap :: - forall a b (t :: * -> *). Foldable t => (a -> [b]) -> t a -> [b] - const :: forall a b. a -> b -> a - cos :: forall a. Floating a => a -> a - cosh :: forall a. Floating a => a -> a - curry :: forall a b c. ((a, b) -> c) -> a -> b -> c - cycle :: forall a. [a] -> [a] - decodeFloat :: forall a. RealFloat a => a -> (Integer, Int) - div :: forall a. Integral a => a -> a -> a - divMod :: forall a. Integral a => a -> a -> (a, a) - drop :: forall a. Int -> [a] -> [a] - dropWhile :: forall a. (a -> Bool) -> [a] -> [a] - either :: forall a c b. (a -> c) -> (b -> c) -> Either a b -> c - elem :: - forall (t :: * -> *) a. (Eq a, Foldable t) => a -> t a -> Bool - encodeFloat :: forall a. RealFloat a => Integer -> Int -> a - enumFrom :: forall a. Enum a => a -> [a] - enumFromThen :: forall a. Enum a => a -> a -> [a] - enumFromThenTo :: forall a. Enum a => a -> a -> a -> [a] - enumFromTo :: forall a. Enum a => a -> a -> [a] - error :: forall a. [Char] -> a - even :: forall a. Integral a => a -> Bool - exp :: forall a. Floating a => a -> a - exponent :: forall a. RealFloat a => a -> Int - fail :: forall (m :: * -> *) a. Monad m => String -> m a - filter :: forall a. (a -> Bool) -> [a] -> [a] - flip :: forall a b c. (a -> b -> c) -> b -> a -> c - floatDigits :: forall a. RealFloat a => a -> Int - floatRadix :: forall a. RealFloat a => a -> Integer - floatRange :: forall a. RealFloat a => a -> (Int, Int) - floor :: forall a b. (Integral b, RealFrac a) => a -> b - fmap :: - forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b - foldl :: - forall (t :: * -> *) b a. - Foldable t => - (b -> a -> b) -> b -> t a -> b - foldl1 :: - forall (t :: * -> *) a. Foldable t => (a -> a -> a) -> t a -> a - foldr :: - forall (t :: * -> *) a b. - Foldable t => - (a -> b -> b) -> b -> t a -> b - foldr1 :: - forall (t :: * -> *) a. Foldable t => (a -> a -> a) -> t a -> a - fromEnum :: forall a. Enum a => a -> Int - fromInteger :: forall a. Num a => Integer -> a - fromIntegral :: forall a b. (Integral a, Num b) => a -> b - fromRational :: forall a. Fractional a => Rational -> a - fst :: forall a b. (a, b) -> a - gcd :: forall a. Integral a => a -> a -> a - getChar :: IO Char - getContents :: IO String - getLine :: IO String - head :: forall a. [a] -> a - id :: forall a. a -> a - init :: forall a. [a] -> [a] - interact :: (String -> String) -> IO () - ioError :: forall a. IOError -> IO a - isDenormalized :: forall a. RealFloat a => a -> Bool - isIEEE :: forall a. RealFloat a => a -> Bool - isInfinite :: forall a. RealFloat a => a -> Bool - isNaN :: forall a. RealFloat a => a -> Bool - isNegativeZero :: forall a. RealFloat a => a -> Bool - iterate :: forall a. (a -> a) -> a -> [a] - last :: forall a. [a] -> a - lcm :: forall a. Integral a => a -> a -> a - length :: forall (t :: * -> *) a. Foldable t => t a -> Int - lex :: ReadS String - lines :: String -> [String] - log :: forall a. Floating a => a -> a - logBase :: forall a. Floating a => a -> a -> a - lookup :: forall a b. Eq a => a -> [(a, b)] -> Maybe b - map :: forall a b. (a -> b) -> [a] -> [b] - mapM :: - forall (t :: * -> *) a (m :: * -> *) b. - (Monad m, Traversable t) => - (a -> m b) -> t a -> m (t b) - mapM_ :: - forall a (m :: * -> *) b (t :: * -> *). - (Monad m, Foldable t) => - (a -> m b) -> t a -> m () - max :: forall a. Ord a => a -> a -> a - maxBound :: forall w_. Bounded w_ => w_ - maximum :: forall (t :: * -> *) a. (Ord a, Foldable t) => t a -> a - maybe :: forall b a. b -> (a -> b) -> Maybe a -> b - min :: forall a. Ord a => a -> a -> a - minBound :: forall w_. Bounded w_ => w_ - minimum :: forall (t :: * -> *) a. (Ord a, Foldable t) => t a -> a - mod :: forall a. Integral a => a -> a -> a - negate :: forall a. Num a => a -> a - not :: Bool -> Bool - notElem :: - forall a (t :: * -> *). (Eq a, Foldable t) => a -> t a -> Bool - null :: forall (t :: * -> *) a. Foldable t => t a -> Bool - odd :: forall a. Integral a => a -> Bool - or :: forall (t :: * -> *). Foldable t => t Bool -> Bool - otherwise :: Bool - pi :: forall w_. Floating w_ => w_ - pred :: forall a. Enum a => a -> a - print :: forall a. Show a => a -> IO () - product :: forall (t :: * -> *) a. (Num a, Foldable t) => t a -> a - properFraction :: - forall a b. (Integral b, RealFrac a) => a -> (b, a) - putChar :: Char -> IO () - putStr :: String -> IO () - putStrLn :: String -> IO () - quot :: forall a. Integral a => a -> a -> a - quotRem :: forall a. Integral a => a -> a -> (a, a) - read :: forall a. Read a => String -> a - readFile :: FilePath -> IO String - readIO :: forall a. Read a => String -> IO a - readList :: forall a. Read a => ReadS [a] - readLn :: forall a. Read a => IO a - readParen :: forall a. Bool -> ReadS a -> ReadS a - reads :: forall a. Read a => ReadS a - readsPrec :: forall a. Read a => Int -> ReadS a - realToFrac :: forall a b. (Fractional b, Real a) => a -> b - recip :: forall a. Fractional a => a -> a - rem :: forall a. Integral a => a -> a -> a - repeat :: forall a. a -> [a] - replicate :: forall a. Int -> a -> [a] - return :: forall (m :: * -> *) a. Monad m => a -> m a - reverse :: forall a. [a] -> [a] - round :: forall a b. (Integral b, RealFrac a) => a -> b - scaleFloat :: forall a. RealFloat a => Int -> a -> a - scanl :: forall b a. (b -> a -> b) -> b -> [a] -> [b] - scanl1 :: forall a. (a -> a -> a) -> [a] -> [a] - scanr :: forall a b. (a -> b -> b) -> b -> [a] -> [b] - scanr1 :: forall a. (a -> a -> a) -> [a] -> [a] - seq :: forall a b. a -> b -> b - sequence :: - forall (t :: * -> *) (m :: * -> *) a. - (Monad m, Traversable t) => - t (m a) -> m (t a) - sequence_ :: - forall (t :: * -> *) (m :: * -> *) a. - (Monad m, Foldable t) => - t (m a) -> m () - show :: forall a. Show a => a -> String - showChar :: Char -> ShowS - showList :: forall a. Show a => [a] -> ShowS - showParen :: Bool -> ShowS -> ShowS - showString :: String -> ShowS - shows :: forall a. Show a => a -> ShowS - showsPrec :: forall a. Show a => Int -> a -> ShowS - significand :: forall a. RealFloat a => a -> a - signum :: forall a. Num a => a -> a - sin :: forall a. Floating a => a -> a - sinh :: forall a. Floating a => a -> a - snd :: forall a b. (a, b) -> b - span :: forall a. (a -> Bool) -> [a] -> ([a], [a]) - splitAt :: forall a. Int -> [a] -> ([a], [a]) - sqrt :: forall a. Floating a => a -> a - subtract :: forall a. Num a => a -> a -> a - succ :: forall a. Enum a => a -> a - sum :: forall (t :: * -> *) a. (Num a, Foldable t) => t a -> a - tail :: forall a. [a] -> [a] - take :: forall a. Int -> [a] -> [a] - takeWhile :: forall a. (a -> Bool) -> [a] -> [a] - tan :: forall a. Floating a => a -> a - tanh :: forall a. Floating a => a -> a - toEnum :: forall a. Enum a => Int -> a - toInteger :: forall a. Integral a => a -> Integer - toRational :: forall a. Real a => a -> Rational - truncate :: forall a b. (Integral b, RealFrac a) => a -> b - uncurry :: forall a b c. (a -> b -> c) -> (a, b) -> c - undefined :: forall w_. w_ - unlines :: [String] -> String - until :: forall a. (a -> Bool) -> (a -> a) -> a -> a - unwords :: [String] -> String - unzip :: forall a b. [(a, b)] -> ([a], [b]) - unzip3 :: forall a b c. [(a, b, c)] -> ([a], [b], [c]) - userError :: String -> IOError - words :: String -> [String] - writeFile :: FilePath -> String -> IO () - zip :: forall a b. [a] -> [b] -> [(a, b)] - zip3 :: forall a b c. [a] -> [b] -> [c] -> [(a, b, c)] - zipWith :: forall a b c. (a -> b -> c) -> [a] -> [b] -> [c] - zipWith3 :: - forall a b c d. (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d] - || :: Bool -> Bool -> Bool -TYPE CONSTRUCTORS -COERCION AXIOMS -Dependent modules: [] -Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0, - integer-gmp-1.0.0.0] +TYPE SIGNATURES
+ !! :: forall a. [a] -> Int -> a
+ $ :: forall a b. (a -> b) -> a -> b
+ $! :: forall a b. (a -> b) -> a -> b
+ && :: Bool -> Bool -> Bool
+ * :: forall a. Num a => a -> a -> a
+ ** :: forall a. Floating a => a -> a -> a
+ + :: forall a. Num a => a -> a -> a
+ ++ :: forall a. [a] -> [a] -> [a]
+ - :: forall a. Num a => a -> a -> a
+ . :: forall b c a. (b -> c) -> (a -> b) -> a -> c
+ / :: forall a. Fractional a => a -> a -> a
+ /= :: forall a. Eq a => a -> a -> Bool
+ < :: forall a. Ord a => a -> a -> Bool
+ <= :: forall a. Ord a => a -> a -> Bool
+ =<< ::
+ forall a (m :: * -> *) b. Monad m => (a -> m b) -> m a -> m b
+ == :: forall a. Eq a => a -> a -> Bool
+ > :: forall a. Ord a => a -> a -> Bool
+ >= :: forall a. Ord a => a -> a -> Bool
+ >> :: forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
+ >>= ::
+ forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
+ ^ :: forall a b. (Integral b, Num a) => a -> b -> a
+ ^^ :: forall a b. (Fractional a, Integral b) => a -> b -> a
+ abs :: forall a. Num a => a -> a
+ acos :: forall a. Floating a => a -> a
+ acosh :: forall a. Floating a => a -> a
+ all ::
+ forall a (t :: * -> *). Foldable t => (a -> Bool) -> t a -> Bool
+ and :: forall (t :: * -> *). Foldable t => t Bool -> Bool
+ any ::
+ forall a (t :: * -> *). Foldable t => (a -> Bool) -> t a -> Bool
+ appendFile :: FilePath -> String -> IO ()
+ asTypeOf :: forall a. a -> a -> a
+ asin :: forall a. Floating a => a -> a
+ asinh :: forall a. Floating a => a -> a
+ atan :: forall a. Floating a => a -> a
+ atan2 :: forall a. RealFloat a => a -> a -> a
+ atanh :: forall a. Floating a => a -> a
+ break :: forall a. (a -> Bool) -> [a] -> ([a], [a])
+ ceiling :: forall a b. (Integral b, RealFrac a) => a -> b
+ compare :: forall a. Ord a => a -> a -> Ordering
+ concat :: forall (t :: * -> *) a. Foldable t => t [a] -> [a]
+ concatMap ::
+ forall a b (t :: * -> *). Foldable t => (a -> [b]) -> t a -> [b]
+ const :: forall a b. a -> b -> a
+ cos :: forall a. Floating a => a -> a
+ cosh :: forall a. Floating a => a -> a
+ curry :: forall a b c. ((a, b) -> c) -> a -> b -> c
+ cycle :: forall a. [a] -> [a]
+ decodeFloat :: forall a. RealFloat a => a -> (Integer, Int)
+ div :: forall a. Integral a => a -> a -> a
+ divMod :: forall a. Integral a => a -> a -> (a, a)
+ drop :: forall a. Int -> [a] -> [a]
+ dropWhile :: forall a. (a -> Bool) -> [a] -> [a]
+ either :: forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
+ elem ::
+ forall (t :: * -> *) a. (Eq a, Foldable t) => a -> t a -> Bool
+ encodeFloat :: forall a. RealFloat a => Integer -> Int -> a
+ enumFrom :: forall a. Enum a => a -> [a]
+ enumFromThen :: forall a. Enum a => a -> a -> [a]
+ enumFromThenTo :: forall a. Enum a => a -> a -> a -> [a]
+ enumFromTo :: forall a. Enum a => a -> a -> [a]
+ error :: forall a. [Char] -> a
+ even :: forall a. Integral a => a -> Bool
+ exp :: forall a. Floating a => a -> a
+ exponent :: forall a. RealFloat a => a -> Int
+ fail :: forall (m :: * -> *) a. Monad m => String -> m a
+ filter :: forall a. (a -> Bool) -> [a] -> [a]
+ flip :: forall a b c. (a -> b -> c) -> b -> a -> c
+ floatDigits :: forall a. RealFloat a => a -> Int
+ floatRadix :: forall a. RealFloat a => a -> Integer
+ floatRange :: forall a. RealFloat a => a -> (Int, Int)
+ floor :: forall a b. (Integral b, RealFrac a) => a -> b
+ fmap ::
+ forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
+ foldl ::
+ forall (t :: * -> *) b a.
+ Foldable t =>
+ (b -> a -> b) -> b -> t a -> b
+ foldl1 ::
+ forall (t :: * -> *) a. Foldable t => (a -> a -> a) -> t a -> a
+ foldr ::
+ forall (t :: * -> *) a b.
+ Foldable t =>
+ (a -> b -> b) -> b -> t a -> b
+ foldr1 ::
+ forall (t :: * -> *) a. Foldable t => (a -> a -> a) -> t a -> a
+ fromEnum :: forall a. Enum a => a -> Int
+ fromInteger :: forall a. Num a => Integer -> a
+ fromIntegral :: forall a b. (Integral a, Num b) => a -> b
+ fromRational :: forall a. Fractional a => Rational -> a
+ fst :: forall a b. (a, b) -> a
+ gcd :: forall a. Integral a => a -> a -> a
+ getChar :: IO Char
+ getContents :: IO String
+ getLine :: IO String
+ head :: forall a. [a] -> a
+ id :: forall a. a -> a
+ init :: forall a. [a] -> [a]
+ interact :: (String -> String) -> IO ()
+ ioError :: forall a. IOError -> IO a
+ isDenormalized :: forall a. RealFloat a => a -> Bool
+ isIEEE :: forall a. RealFloat a => a -> Bool
+ isInfinite :: forall a. RealFloat a => a -> Bool
+ isNaN :: forall a. RealFloat a => a -> Bool
+ isNegativeZero :: forall a. RealFloat a => a -> Bool
+ iterate :: forall a. (a -> a) -> a -> [a]
+ last :: forall a. [a] -> a
+ lcm :: forall a. Integral a => a -> a -> a
+ length :: forall (t :: * -> *) a. Foldable t => t a -> Int
+ lex :: ReadS String
+ lines :: String -> [String]
+ log :: forall a. Floating a => a -> a
+ logBase :: forall a. Floating a => a -> a -> a
+ lookup :: forall a b. Eq a => a -> [(a, b)] -> Maybe b
+ map :: forall a b. (a -> b) -> [a] -> [b]
+ mapM ::
+ forall (t :: * -> *) a (m :: * -> *) b.
+ (Monad m, Traversable t) =>
+ (a -> m b) -> t a -> m (t b)
+ mapM_ ::
+ forall a (m :: * -> *) b (t :: * -> *).
+ (Monad m, Foldable t) =>
+ (a -> m b) -> t a -> m ()
+ max :: forall a. Ord a => a -> a -> a
+ maxBound :: forall t. Bounded t => t
+ maximum :: forall (t :: * -> *) a. (Ord a, Foldable t) => t a -> a
+ maybe :: forall b a. b -> (a -> b) -> Maybe a -> b
+ min :: forall a. Ord a => a -> a -> a
+ minBound :: forall t. Bounded t => t
+ minimum :: forall (t :: * -> *) a. (Ord a, Foldable t) => t a -> a
+ mod :: forall a. Integral a => a -> a -> a
+ negate :: forall a. Num a => a -> a
+ not :: Bool -> Bool
+ notElem ::
+ forall a (t :: * -> *). (Eq a, Foldable t) => a -> t a -> Bool
+ null :: forall (t :: * -> *) a. Foldable t => t a -> Bool
+ odd :: forall a. Integral a => a -> Bool
+ or :: forall (t :: * -> *). Foldable t => t Bool -> Bool
+ otherwise :: Bool
+ pi :: forall t. Floating t => t
+ pred :: forall a. Enum a => a -> a
+ print :: forall a. Show a => a -> IO ()
+ product :: forall (t :: * -> *) a. (Num a, Foldable t) => t a -> a
+ properFraction ::
+ forall a b. (Integral b, RealFrac a) => a -> (b, a)
+ putChar :: Char -> IO ()
+ putStr :: String -> IO ()
+ putStrLn :: String -> IO ()
+ quot :: forall a. Integral a => a -> a -> a
+ quotRem :: forall a. Integral a => a -> a -> (a, a)
+ read :: forall a. Read a => String -> a
+ readFile :: FilePath -> IO String
+ readIO :: forall a. Read a => String -> IO a
+ readList :: forall a. Read a => ReadS [a]
+ readLn :: forall a. Read a => IO a
+ readParen :: forall a. Bool -> ReadS a -> ReadS a
+ reads :: forall a. Read a => ReadS a
+ readsPrec :: forall a. Read a => Int -> ReadS a
+ realToFrac :: forall a b. (Fractional b, Real a) => a -> b
+ recip :: forall a. Fractional a => a -> a
+ rem :: forall a. Integral a => a -> a -> a
+ repeat :: forall a. a -> [a]
+ replicate :: forall a. Int -> a -> [a]
+ return :: forall (m :: * -> *) a. Monad m => a -> m a
+ reverse :: forall a. [a] -> [a]
+ round :: forall a b. (Integral b, RealFrac a) => a -> b
+ scaleFloat :: forall a. RealFloat a => Int -> a -> a
+ scanl :: forall b a. (b -> a -> b) -> b -> [a] -> [b]
+ scanl1 :: forall a. (a -> a -> a) -> [a] -> [a]
+ scanr :: forall a b. (a -> b -> b) -> b -> [a] -> [b]
+ scanr1 :: forall a. (a -> a -> a) -> [a] -> [a]
+ seq :: forall a b. a -> b -> b
+ sequence ::
+ forall (t :: * -> *) (m :: * -> *) a.
+ (Monad m, Traversable t) =>
+ t (m a) -> m (t a)
+ sequence_ ::
+ forall (t :: * -> *) (m :: * -> *) a.
+ (Monad m, Foldable t) =>
+ t (m a) -> m ()
+ show :: forall a. Show a => a -> String
+ showChar :: Char -> ShowS
+ showList :: forall a. Show a => [a] -> ShowS
+ showParen :: Bool -> ShowS -> ShowS
+ showString :: String -> ShowS
+ shows :: forall a. Show a => a -> ShowS
+ showsPrec :: forall a. Show a => Int -> a -> ShowS
+ significand :: forall a. RealFloat a => a -> a
+ signum :: forall a. Num a => a -> a
+ sin :: forall a. Floating a => a -> a
+ sinh :: forall a. Floating a => a -> a
+ snd :: forall a b. (a, b) -> b
+ span :: forall a. (a -> Bool) -> [a] -> ([a], [a])
+ splitAt :: forall a. Int -> [a] -> ([a], [a])
+ sqrt :: forall a. Floating a => a -> a
+ subtract :: forall a. Num a => a -> a -> a
+ succ :: forall a. Enum a => a -> a
+ sum :: forall (t :: * -> *) a. (Num a, Foldable t) => t a -> a
+ tail :: forall a. [a] -> [a]
+ take :: forall a. Int -> [a] -> [a]
+ takeWhile :: forall a. (a -> Bool) -> [a] -> [a]
+ tan :: forall a. Floating a => a -> a
+ tanh :: forall a. Floating a => a -> a
+ toEnum :: forall a. Enum a => Int -> a
+ toInteger :: forall a. Integral a => a -> Integer
+ toRational :: forall a. Real a => a -> Rational
+ truncate :: forall a b. (Integral b, RealFrac a) => a -> b
+ uncurry :: forall a b c. (a -> b -> c) -> (a, b) -> c
+ undefined :: forall t. t
+ unlines :: [String] -> String
+ until :: forall a. (a -> Bool) -> (a -> a) -> a -> a
+ unwords :: [String] -> String
+ unzip :: forall a b. [(a, b)] -> ([a], [b])
+ unzip3 :: forall a b c. [(a, b, c)] -> ([a], [b], [c])
+ userError :: String -> IOError
+ words :: String -> [String]
+ writeFile :: FilePath -> String -> IO ()
+ zip :: forall a b. [a] -> [b] -> [(a, b)]
+ zip3 :: forall a b c. [a] -> [b] -> [c] -> [(a, b, c)]
+ zipWith :: forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
+ zipWith3 ::
+ forall a b c d. (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
+ || :: Bool -> Bool -> Bool
+TYPE CONSTRUCTORS
+COERCION AXIOMS
+Dependent modules: []
+Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0,
+ integer-gmp-1.0.0.0]
diff --git a/testsuite/tests/partial-sigs/should_compile/ShowNamed.stderr b/testsuite/tests/partial-sigs/should_compile/ShowNamed.stderr index a986d76fa7..97eb78730c 100644 --- a/testsuite/tests/partial-sigs/should_compile/ShowNamed.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ShowNamed.stderr @@ -1,7 +1,7 @@ -TYPE SIGNATURES - showTwo :: forall w_a. Show w_a => w_a -> String -TYPE CONSTRUCTORS -COERCION AXIOMS -Dependent modules: [] -Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0, - integer-gmp-1.0.0.0] +TYPE SIGNATURES
+ showTwo :: forall a. Show a => a -> String
+TYPE CONSTRUCTORS
+COERCION AXIOMS
+Dependent modules: []
+Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0,
+ integer-gmp-1.0.0.0]
diff --git a/testsuite/tests/partial-sigs/should_compile/SimpleGen.stderr b/testsuite/tests/partial-sigs/should_compile/SimpleGen.stderr index e2b91c1c8c..8f2efacc84 100644 --- a/testsuite/tests/partial-sigs/should_compile/SimpleGen.stderr +++ b/testsuite/tests/partial-sigs/should_compile/SimpleGen.stderr @@ -1,7 +1,7 @@ -TYPE SIGNATURES - bar :: forall w_. w_ -> Bool -TYPE CONSTRUCTORS -COERCION AXIOMS -Dependent modules: [] -Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0, - integer-gmp-1.0.0.0] +TYPE SIGNATURES
+ bar :: forall t. t -> Bool
+TYPE CONSTRUCTORS
+COERCION AXIOMS
+Dependent modules: []
+Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0,
+ integer-gmp-1.0.0.0]
diff --git a/testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr b/testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr index 312cf25217..de30497289 100644 --- a/testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr +++ b/testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr @@ -1,73 +1,82 @@ -[1 of 2] Compiling Splices ( Splices.hs, Splices.o ) -[2 of 2] Compiling SplicesUsed ( SplicesUsed.hs, SplicesUsed.o ) - -SplicesUsed.hs:7:16: warning: - Found type wildcard ‘_’ standing for ‘Maybe Bool’ - In the type signature for ‘maybeBool’: _ - -SplicesUsed.hs:8:15: warning: - Found type wildcard ‘_a’ standing for ‘Maybe Bool’ - Relevant bindings include - maybeBool :: Maybe Bool (bound at SplicesUsed.hs:8:1) - In an expression type signature: _a -> _a - In the expression: id :: _a -> _a - In the expression: (id :: _a -> _a) (Just True :: Maybe _) - -SplicesUsed.hs:8:27: warning: - Found type wildcard ‘_’ standing for ‘Bool’ - Relevant bindings include - maybeBool :: Maybe Bool (bound at SplicesUsed.hs:8:1) - In an expression type signature: Maybe _ - In the first argument of ‘id :: _a -> _a’, namely - ‘(Just True :: Maybe _)’ - In the expression: (id :: _a -> _a) (Just True :: Maybe _) - -SplicesUsed.hs:10:17: warning: - Found type wildcard ‘_’ standing for ‘(Char, a)’ - Where: ‘a’ is a rigid type variable bound by - the inferred type of charA :: a -> (Char, a) - at SplicesUsed.hs:10:10 - In the type signature for ‘charA’: a -> _ - -SplicesUsed.hs:13:14: warning: - Found type wildcard ‘_’ standing for ‘a -> Bool’ - Where: ‘a’ is a rigid type variable bound by - the inferred type of filter' :: (a -> Bool) -> [a] -> [a] - at SplicesUsed.hs:14:1 - In the type signature for ‘filter'’: _ -> _ -> _ - -SplicesUsed.hs:13:14: warning: - Found type wildcard ‘_’ standing for ‘[a]’ - Where: ‘a’ is a rigid type variable bound by - the inferred type of filter' :: (a -> Bool) -> [a] -> [a] - at SplicesUsed.hs:14:1 - In the type signature for ‘filter'’: _ -> _ -> _ - -SplicesUsed.hs:13:14: warning: - Found type wildcard ‘_’ standing for ‘[a]’ - Where: ‘a’ is a rigid type variable bound by - the inferred type of filter' :: (a -> Bool) -> [a] -> [a] - at SplicesUsed.hs:14:1 - In the type signature for ‘filter'’: _ -> _ -> _ - -SplicesUsed.hs:16:3: warning: - Found hole ‘_’ with inferred constraints: Eq a - In the type signature for ‘foo’: _ => _ - -SplicesUsed.hs:16:3: warning: - Found type wildcard ‘_’ standing for ‘a -> a -> Bool’ - Where: ‘a’ is a rigid type variable bound by - the inferred type of foo :: Eq a => a -> a -> Bool - at SplicesUsed.hs:16:3 - In the type signature for ‘foo’: _ => _ - -SplicesUsed.hs:18:3: warning: - Found type wildcard ‘_a’ standing for ‘Bool’ - In the type signature for ‘bar’: _a -> _b -> (_a, _b) - -SplicesUsed.hs:18:3: warning: - Found type wildcard ‘_b’ standing for ‘w_b’ - Where: ‘w_b’ is a rigid type variable bound by - the inferred type of bar :: Bool -> w_b -> (Bool, w_b) - at SplicesUsed.hs:18:3 - In the type signature for ‘bar’: _a -> _b -> (_a, _b) +[1 of 2] Compiling Splices ( Splices.hs, Splices.o )
+[2 of 2] Compiling SplicesUsed ( SplicesUsed.hs, SplicesUsed.o )
+
+SplicesUsed.hs:7:16: warning:
+ Found type wildcard ‘_’ standing for ‘Maybe Bool’
+ In the type signature for:
+ maybeBool :: _
+
+SplicesUsed.hs:8:15: warning:
+ Found type wildcard ‘_a’ standing for ‘Maybe Bool’
+ Relevant bindings include
+ maybeBool :: Maybe Bool (bound at SplicesUsed.hs:8:1)
+ In an expression type signature: _a -> _a
+ In the expression: id :: _a -> _a
+ In the expression: (id :: _a -> _a) (Just True :: Maybe _)
+
+SplicesUsed.hs:8:27: warning:
+ Found type wildcard ‘_’ standing for ‘Bool’
+ Relevant bindings include
+ maybeBool :: Maybe Bool (bound at SplicesUsed.hs:8:1)
+ In an expression type signature: Maybe _
+ In the first argument of ‘id :: _a -> _a’, namely
+ ‘(Just True :: Maybe _)’
+ In the expression: (id :: _a -> _a) (Just True :: Maybe _)
+
+SplicesUsed.hs:10:17: warning:
+ Found type wildcard ‘_’ standing for ‘(Char, a)’
+ Where: ‘a’ is a rigid type variable bound by
+ the inferred type of charA :: a -> (Char, a)
+ at SplicesUsed.hs:10:10
+ In the type signature for:
+ charA :: a -> (_)
+
+SplicesUsed.hs:13:14: warning:
+ Found type wildcard ‘_’ standing for ‘a -> Bool’
+ Where: ‘a’ is a rigid type variable bound by
+ the inferred type of filter' :: (a -> Bool) -> [a] -> [a]
+ at SplicesUsed.hs:14:1
+ In the type signature for:
+ filter' :: _ -> _ -> _
+
+SplicesUsed.hs:13:14: warning:
+ Found type wildcard ‘_’ standing for ‘[a]’
+ Where: ‘a’ is a rigid type variable bound by
+ the inferred type of filter' :: (a -> Bool) -> [a] -> [a]
+ at SplicesUsed.hs:14:1
+ In the type signature for:
+ filter' :: _ -> _ -> _
+
+SplicesUsed.hs:13:14: warning:
+ Found type wildcard ‘_’ standing for ‘[a]’
+ Where: ‘a’ is a rigid type variable bound by
+ the inferred type of filter' :: (a -> Bool) -> [a] -> [a]
+ at SplicesUsed.hs:14:1
+ In the type signature for:
+ filter' :: _ -> _ -> _
+
+SplicesUsed.hs:16:3: warning:
+ Found hole ‘_’ with inferred constraints: Eq a
+ In the type signature for:
+ foo :: _ => _
+
+SplicesUsed.hs:16:3: warning:
+ Found type wildcard ‘_’ standing for ‘a -> a -> Bool’
+ Where: ‘a’ is a rigid type variable bound by
+ the inferred type of foo :: Eq a => a -> a -> Bool
+ at SplicesUsed.hs:16:3
+ In the type signature for:
+ foo :: _ => _
+
+SplicesUsed.hs:18:3: warning:
+ Found type wildcard ‘_a’ standing for ‘Bool’
+ In the type signature for:
+ bar :: _a -> _b -> (_a, _b)
+
+SplicesUsed.hs:18:3: warning:
+ Found type wildcard ‘_b’ standing for ‘t’
+ Where: ‘t’ is a rigid type variable bound by
+ the inferred type of bar :: Bool -> t -> (Bool, t)
+ at SplicesUsed.hs:18:3
+ In the type signature for:
+ bar :: _a -> _b -> (_a, _b)
diff --git a/testsuite/tests/partial-sigs/should_compile/T10403.stderr b/testsuite/tests/partial-sigs/should_compile/T10403.stderr index 389f676eaf..8af7da3d81 100644 --- a/testsuite/tests/partial-sigs/should_compile/T10403.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T10403.stderr @@ -1,36 +1,39 @@ - -T10403.hs:15:7: warning: - Found hole ‘_’ with inferred constraints: Functor f - In the type signature for ‘h1’: _ => _ - -T10403.hs:15:12: warning: - Found type wildcard ‘_’ standing for ‘(a -> b) -> f a -> H f’ - Where: ‘f’ is a rigid type variable bound by - the inferred type of h1 :: Functor f => (a -> b) -> f a -> H f - at T10403.hs:17:1 - ‘b’ is a rigid type variable bound by - the inferred type of h1 :: Functor f => (a -> b) -> f a -> H f - at T10403.hs:17:1 - ‘a’ is a rigid type variable bound by - the inferred type of h1 :: Functor f => (a -> b) -> f a -> H f - at T10403.hs:17:1 - In the type signature for ‘h1’: _ => _ - -T10403.hs:19:7: warning: - Found type wildcard ‘_’ standing for ‘(a -> b) -> f a -> H f’ - Where: ‘f’ is a rigid type variable bound by - the inferred type of h2 :: Functor f => (a -> b) -> f a -> H f - at T10403.hs:21:1 - ‘b’ is a rigid type variable bound by - the inferred type of h2 :: Functor f => (a -> b) -> f a -> H f - at T10403.hs:21:1 - ‘a’ is a rigid type variable bound by - the inferred type of h2 :: Functor f => (a -> b) -> f a -> H f - at T10403.hs:21:1 - In the type signature for ‘h2’: _ - -T10403.hs:21:1: warning: - No instance for (Functor f) - When checking that ‘h2’ has the inferred type - h2 :: forall (f :: * -> *) b a. (a -> b) -> f a -> H f - Probable cause: the inferred type is ambiguous +
+T10403.hs:15:7: warning:
+ Found hole ‘_’ with inferred constraints: Functor f
+ In the type signature for:
+ h1 :: _ => _
+
+T10403.hs:15:12: warning:
+ Found type wildcard ‘_’ standing for ‘(a -> b) -> f a -> H f’
+ Where: ‘f’ is a rigid type variable bound by
+ the inferred type of h1 :: Functor f => (a -> b) -> f a -> H f
+ at T10403.hs:17:1
+ ‘b’ is a rigid type variable bound by
+ the inferred type of h1 :: Functor f => (a -> b) -> f a -> H f
+ at T10403.hs:17:1
+ ‘a’ is a rigid type variable bound by
+ the inferred type of h1 :: Functor f => (a -> b) -> f a -> H f
+ at T10403.hs:17:1
+ In the type signature for:
+ h1 :: _ => _
+
+T10403.hs:19:7: warning:
+ Found type wildcard ‘_’ standing for ‘(a -> b) -> f a -> H f’
+ Where: ‘f’ is a rigid type variable bound by
+ the inferred type of h2 :: Functor f => (a -> b) -> f a -> H f
+ at T10403.hs:21:1
+ ‘b’ is a rigid type variable bound by
+ the inferred type of h2 :: Functor f => (a -> b) -> f a -> H f
+ at T10403.hs:21:1
+ ‘a’ is a rigid type variable bound by
+ the inferred type of h2 :: Functor f => (a -> b) -> f a -> H f
+ at T10403.hs:21:1
+ In the type signature for:
+ h2 :: _
+
+T10403.hs:21:1: warning:
+ No instance for (Functor f)
+ When checking that ‘h2’ has the inferred type
+ h2 :: forall (f :: * -> *) b a. (a -> b) -> f a -> H f
+ Probable cause: the inferred type is ambiguous
diff --git a/testsuite/tests/partial-sigs/should_compile/T10438.stderr b/testsuite/tests/partial-sigs/should_compile/T10438.stderr index 34fe24bba4..7c2a0907e8 100644 --- a/testsuite/tests/partial-sigs/should_compile/T10438.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T10438.stderr @@ -1,26 +1,27 @@ - -T10438.hs:7:22: warning: - Found type wildcard ‘_’ standing for ‘w_1’ - Where: ‘w_1’ is a rigid type variable bound by - the inferred type of g :: w_1 -> w_1 at T10438.hs:6:9 - Relevant bindings include - r :: w_1 (bound at T10438.hs:6:11) - g :: w_1 -> w_1 (bound at T10438.hs:6:9) - f :: t (bound at T10438.hs:5:5) - foo :: t -> w_ -> w_ (bound at T10438.hs:5:1) - In the type signature for ‘x’: _ - In an equation for ‘g’: - g r - = x - where - x :: _ - x = r - In an equation for ‘foo’: - foo f - = g - where - g r - = x - where - x :: _ - x = r +
+T10438.hs:7:22: warning:
+ Found type wildcard ‘_’ standing for ‘t2’
+ Where: ‘t2’ is a rigid type variable bound by
+ the inferred type of g :: t2 -> t2 at T10438.hs:6:9
+ Relevant bindings include
+ r :: t2 (bound at T10438.hs:6:11)
+ g :: t2 -> t2 (bound at T10438.hs:6:9)
+ f :: t (bound at T10438.hs:5:5)
+ foo :: t -> t1 -> t1 (bound at T10438.hs:5:1)
+ In the type signature for:
+ x :: _
+ In an equation for ‘g’:
+ g r
+ = x
+ where
+ x :: _
+ x = r
+ In an equation for ‘foo’:
+ foo f
+ = g
+ where
+ g r
+ = x
+ where
+ x :: _
+ x = r
diff --git a/testsuite/tests/partial-sigs/should_compile/T10519.stderr b/testsuite/tests/partial-sigs/should_compile/T10519.stderr index 254292f6b2..de53da2d33 100644 --- a/testsuite/tests/partial-sigs/should_compile/T10519.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T10519.stderr @@ -1,4 +1,5 @@ - -T10519.hs:5:18: warning: - Found hole ‘_’ with inferred constraints: Eq a - In the type signature for ‘foo’: _ => a -> a -> Bool +
+T10519.hs:5:18: warning:
+ Found hole ‘_’ with inferred constraints: Eq a
+ In the type signature for:
+ foo :: forall a. _ => a -> a -> Bool
diff --git a/testsuite/tests/partial-sigs/should_compile/Uncurry.stderr b/testsuite/tests/partial-sigs/should_compile/Uncurry.stderr index 707bb9e770..6a4028402b 100644 --- a/testsuite/tests/partial-sigs/should_compile/Uncurry.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Uncurry.stderr @@ -1,7 +1,7 @@ -TYPE SIGNATURES - unc :: forall w_ w_1 w_2. (w_1 -> w_2 -> w_) -> (w_1, w_2) -> w_ -TYPE CONSTRUCTORS -COERCION AXIOMS -Dependent modules: [] -Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0, - integer-gmp-1.0.0.0] +TYPE SIGNATURES
+ unc :: forall t t1 t2. (t -> t1 -> t2) -> (t, t1) -> t2
+TYPE CONSTRUCTORS
+COERCION AXIOMS
+Dependent modules: []
+Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0,
+ integer-gmp-1.0.0.0]
diff --git a/testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr b/testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr index e1b1bfdf1a..9048c1d524 100644 --- a/testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr +++ b/testsuite/tests/partial-sigs/should_compile/UncurryNamed.stderr @@ -1,7 +1,7 @@ -TYPE SIGNATURES - unc :: forall w_a w_b w_c. (w_a -> w_b -> w_c) -> (w_a, w_b) -> w_c -TYPE CONSTRUCTORS -COERCION AXIOMS -Dependent modules: [] -Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0, - integer-gmp-1.0.0.0] +TYPE SIGNATURES
+ unc :: forall t a b. (a -> b -> t) -> (a, b) -> t
+TYPE CONSTRUCTORS
+COERCION AXIOMS
+Dependent modules: []
+Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0,
+ integer-gmp-1.0.0.0]
diff --git a/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr b/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr index b259e32757..3037db7666 100644 --- a/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr +++ b/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr @@ -1,47 +1,53 @@ -TYPE SIGNATURES - bar :: forall w_ w_1. w_ -> (w_ -> w_1) -> w_1 - foo :: forall w_a. (Show w_a, Enum w_a) => w_a -> String -TYPE CONSTRUCTORS -COERCION AXIOMS -Dependent modules: [] -Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0, - integer-gmp-1.0.0.0] - -WarningWildcardInstantiations.hs:5:14: warning: - Found type wildcard ‘_a’ standing for ‘w_a’ - Where: ‘w_a’ is a rigid type variable bound by - the inferred type of foo :: (Enum w_a, Show w_a) => w_a -> String - at WarningWildcardInstantiations.hs:6:1 - In the type signature for ‘foo’: (Show _a, _) => _a -> _ - -WarningWildcardInstantiations.hs:5:18: warning: - Found hole ‘_’ with inferred constraints: Enum w_a - In the type signature for ‘foo’: (Show _a, _) => _a -> _ - -WarningWildcardInstantiations.hs:5:30: warning: - Found type wildcard ‘_’ standing for ‘String’ - In the type signature for ‘foo’: (Show _a, _) => _a -> _ - -WarningWildcardInstantiations.hs:8:8: warning: - Found type wildcard ‘_’ standing for ‘w_’ - Where: ‘w_’ is a rigid type variable bound by - the inferred type of bar :: w_ -> (w_ -> w_1) -> w_1 - at WarningWildcardInstantiations.hs:9:1 - In the type signature for ‘bar’: _ -> _ -> _ - -WarningWildcardInstantiations.hs:8:13: warning: - Found type wildcard ‘_’ standing for ‘w_ -> w_1’ - Where: ‘w_’ is a rigid type variable bound by - the inferred type of bar :: w_ -> (w_ -> w_1) -> w_1 - at WarningWildcardInstantiations.hs:9:1 - ‘w_1’ is a rigid type variable bound by - the inferred type of bar :: w_ -> (w_ -> w_1) -> w_1 - at WarningWildcardInstantiations.hs:9:1 - In the type signature for ‘bar’: _ -> _ -> _ - -WarningWildcardInstantiations.hs:8:18: warning: - Found type wildcard ‘_’ standing for ‘w_1’ - Where: ‘w_1’ is a rigid type variable bound by - the inferred type of bar :: w_ -> (w_ -> w_1) -> w_1 - at WarningWildcardInstantiations.hs:9:1 - In the type signature for ‘bar’: _ -> _ -> _ +TYPE SIGNATURES
+ bar :: forall t t1. t -> (t -> t1) -> t1
+ foo :: forall a. (Show a, Enum a) => a -> String
+TYPE CONSTRUCTORS
+COERCION AXIOMS
+Dependent modules: []
+Dependent packages: [base-4.8.2.0, ghc-prim-0.4.0.0,
+ integer-gmp-1.0.0.0]
+
+WarningWildcardInstantiations.hs:5:14: warning:
+ Found type wildcard ‘_a’ standing for ‘a’
+ Where: ‘a’ is a rigid type variable bound by
+ the inferred type of foo :: (Enum a, Show a) => a -> String
+ at WarningWildcardInstantiations.hs:6:1
+ In the type signature for:
+ foo :: (Show _a, _) => _a -> _
+
+WarningWildcardInstantiations.hs:5:18: warning:
+ Found hole ‘_’ with inferred constraints: Enum a
+ In the type signature for:
+ foo :: (Show _a, _) => _a -> _
+
+WarningWildcardInstantiations.hs:5:30: warning:
+ Found type wildcard ‘_’ standing for ‘String’
+ In the type signature for:
+ foo :: (Show _a, _) => _a -> _
+
+WarningWildcardInstantiations.hs:8:8: warning:
+ Found type wildcard ‘_’ standing for ‘t’
+ Where: ‘t’ is a rigid type variable bound by
+ the inferred type of bar :: t -> (t -> t1) -> t1
+ at WarningWildcardInstantiations.hs:9:1
+ In the type signature for:
+ bar :: _ -> _ -> _
+
+WarningWildcardInstantiations.hs:8:13: warning:
+ Found type wildcard ‘_’ standing for ‘t -> t1’
+ Where: ‘t’ is a rigid type variable bound by
+ the inferred type of bar :: t -> (t -> t1) -> t1
+ at WarningWildcardInstantiations.hs:9:1
+ ‘t1’ is a rigid type variable bound by
+ the inferred type of bar :: t -> (t -> t1) -> t1
+ at WarningWildcardInstantiations.hs:9:1
+ In the type signature for:
+ bar :: _ -> _ -> _
+
+WarningWildcardInstantiations.hs:8:18: warning:
+ Found type wildcard ‘_’ standing for ‘t1’
+ Where: ‘t1’ is a rigid type variable bound by
+ the inferred type of bar :: t -> (t -> t1) -> t1
+ at WarningWildcardInstantiations.hs:9:1
+ In the type signature for:
+ bar :: _ -> _ -> _
diff --git a/testsuite/tests/partial-sigs/should_fail/Defaulting1MROff.stderr b/testsuite/tests/partial-sigs/should_fail/Defaulting1MROff.stderr index 560fe792db..43bd7b1938 100644 --- a/testsuite/tests/partial-sigs/should_fail/Defaulting1MROff.stderr +++ b/testsuite/tests/partial-sigs/should_fail/Defaulting1MROff.stderr @@ -1,6 +1,6 @@ - -Defaulting1MROff.hs:6:1: - No instance for (Num w_) - When checking that ‘alpha’ has the inferred type - alpha :: forall w_. w_ - Probable cause: the inferred type is ambiguous +
+Defaulting1MROff.hs:6:1: error:
+ No instance for (Num t)
+ When checking that ‘alpha’ has the inferred type
+ alpha :: forall t. t
+ Probable cause: the inferred type is ambiguous
diff --git a/testsuite/tests/partial-sigs/should_fail/ExtraConstraintsWildcardNotEnabled.stderr b/testsuite/tests/partial-sigs/should_fail/ExtraConstraintsWildcardNotEnabled.stderr index 64839127c7..a8ea30ecf7 100644 --- a/testsuite/tests/partial-sigs/should_fail/ExtraConstraintsWildcardNotEnabled.stderr +++ b/testsuite/tests/partial-sigs/should_fail/ExtraConstraintsWildcardNotEnabled.stderr @@ -1,5 +1,6 @@ - -ExtraConstraintsWildcardNotEnabled.hs:4:10: - Found hole ‘_’ with inferred constraints: Show a - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘show'’: _ => a -> String +
+ExtraConstraintsWildcardNotEnabled.hs:4:10: error:
+ Found hole ‘_’ with inferred constraints: Show a
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ show' :: _ => a -> String
diff --git a/testsuite/tests/partial-sigs/should_fail/InstantiatedNamedWildcardsInConstraints.stderr b/testsuite/tests/partial-sigs/should_fail/InstantiatedNamedWildcardsInConstraints.stderr index e2ba5c19c9..2bdc01e8ef 100644 --- a/testsuite/tests/partial-sigs/should_fail/InstantiatedNamedWildcardsInConstraints.stderr +++ b/testsuite/tests/partial-sigs/should_fail/InstantiatedNamedWildcardsInConstraints.stderr @@ -1,13 +1,15 @@ - -InstantiatedNamedWildcardsInConstraints.hs:4:14: error: - Found type wildcard ‘_a’ standing for ‘b’ - Where: ‘b’ is a rigid type variable bound by - the inferred type of foo :: (Enum b, Show b) => b -> (String, b) - at InstantiatedNamedWildcardsInConstraints.hs:4:8 - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘foo’: (Enum _a, _) => _a -> (String, b) - -InstantiatedNamedWildcardsInConstraints.hs:4:18: error: - Found hole ‘_’ with inferred constraints: Show b - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘foo’: (Enum _a, _) => _a -> (String, b) +
+InstantiatedNamedWildcardsInConstraints.hs:4:14: error:
+ Found type wildcard ‘_a’ standing for ‘b’
+ Where: ‘b’ is a rigid type variable bound by
+ the inferred type of foo :: (Enum b, Show b) => b -> (String, b)
+ at InstantiatedNamedWildcardsInConstraints.hs:4:8
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ foo :: (Enum _a, _) => _a -> (String, b)
+
+InstantiatedNamedWildcardsInConstraints.hs:4:18: error:
+ Found hole ‘_’ with inferred constraints: Show b
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ foo :: (Enum _a, _) => _a -> (String, b)
diff --git a/testsuite/tests/partial-sigs/should_fail/NamedWildcardsEnabled.stderr b/testsuite/tests/partial-sigs/should_fail/NamedWildcardsEnabled.stderr index 5939ed79b0..6fa82994e4 100644 --- a/testsuite/tests/partial-sigs/should_fail/NamedWildcardsEnabled.stderr +++ b/testsuite/tests/partial-sigs/should_fail/NamedWildcardsEnabled.stderr @@ -1,10 +1,12 @@ - -NamedWildcardsEnabled.hs:4:8: error: - Found type wildcard ‘_a’ standing for ‘Bool’ - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘foo’: _a -> _b - -NamedWildcardsEnabled.hs:4:14: error: - Found type wildcard ‘_b’ standing for ‘Bool’ - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘foo’: _a -> _b +
+NamedWildcardsEnabled.hs:4:8: error:
+ Found type wildcard ‘_a’ standing for ‘Bool’
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ foo :: _a -> _b
+
+NamedWildcardsEnabled.hs:4:14: error:
+ Found type wildcard ‘_b’ standing for ‘Bool’
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ foo :: _a -> _b
diff --git a/testsuite/tests/partial-sigs/should_fail/PartialTypeSignaturesDisabled.stderr b/testsuite/tests/partial-sigs/should_fail/PartialTypeSignaturesDisabled.stderr index 5559c16969..fbff3580d0 100644 --- a/testsuite/tests/partial-sigs/should_fail/PartialTypeSignaturesDisabled.stderr +++ b/testsuite/tests/partial-sigs/should_fail/PartialTypeSignaturesDisabled.stderr @@ -1,10 +1,12 @@ - -PartialTypeSignaturesDisabled.hs:4:8: error: - Found type wildcard ‘_’ standing for ‘Bool’ - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘foo’: _ -> _ - -PartialTypeSignaturesDisabled.hs:4:13: error: - Found type wildcard ‘_’ standing for ‘Bool’ - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘foo’: _ -> _ +
+PartialTypeSignaturesDisabled.hs:4:8: error:
+ Found type wildcard ‘_’ standing for ‘Bool’
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ foo :: _ -> _
+
+PartialTypeSignaturesDisabled.hs:4:13: error:
+ Found type wildcard ‘_’ standing for ‘Bool’
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ foo :: _ -> _
diff --git a/testsuite/tests/partial-sigs/should_fail/TidyClash.stderr b/testsuite/tests/partial-sigs/should_fail/TidyClash.stderr index 11161be529..795789185e 100644 --- a/testsuite/tests/partial-sigs/should_fail/TidyClash.stderr +++ b/testsuite/tests/partial-sigs/should_fail/TidyClash.stderr @@ -1,16 +1,16 @@ - -TidyClash.hs:8:19: error: - Found type wildcard ‘_’ standing for ‘w_’ - Where: ‘w_’ is a rigid type variable bound by - the inferred type of bar :: w_2 -> (w_2, w_ -> w_1) - at TidyClash.hs:9:1 - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘bar’: w_ -> (w_, _ -> _) - -TidyClash.hs:8:24: error: - Found type wildcard ‘_’ standing for ‘w_1’ - Where: ‘w_1’ is a rigid type variable bound by - the inferred type of bar :: w_2 -> (w_2, w_ -> w_1) - at TidyClash.hs:9:1 - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘bar’: w_ -> (w_, _ -> _) +
+TidyClash.hs:8:19: error:
+ Found type wildcard ‘_’ standing for ‘t’
+ Where: ‘t’ is a rigid type variable bound by
+ the inferred type of bar :: w_ -> (w_, t -> t1) at TidyClash.hs:9:1
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ bar :: w_ -> (w_, _ -> _)
+
+TidyClash.hs:8:24: error:
+ Found type wildcard ‘_’ standing for ‘t1’
+ Where: ‘t1’ is a rigid type variable bound by
+ the inferred type of bar :: w_ -> (w_, t -> t1) at TidyClash.hs:9:1
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ bar :: w_ -> (w_, _ -> _)
diff --git a/testsuite/tests/partial-sigs/should_fail/Trac10045.stderr b/testsuite/tests/partial-sigs/should_fail/Trac10045.stderr index 14302fb98d..da0f8c78b7 100644 --- a/testsuite/tests/partial-sigs/should_fail/Trac10045.stderr +++ b/testsuite/tests/partial-sigs/should_fail/Trac10045.stderr @@ -1,45 +1,46 @@ - -Trac10045.hs:6:17: error: - Found type wildcard ‘_’ standing for ‘t1 -> a -> t2’ - Where: ‘t1’ is a rigid type variable bound by - the inferred type of copy :: Num a => t1 -> a -> t2 - at Trac10045.hs:7:9 - ‘t2’ is a rigid type variable bound by - the inferred type of copy :: Num a => t1 -> a -> t2 - at Trac10045.hs:7:9 - ‘a’ is a rigid type variable bound by - the inferred type of copy :: Num a => t1 -> a -> t2 - at Trac10045.hs:7:9 - To use the inferred type, enable PartialTypeSignatures - Relevant bindings include - ws1 :: () (bound at Trac10045.hs:5:11) - foo :: Meta -> t (bound at Trac10045.hs:5:1) - In the type signature for ‘copy’: _ - In the expression: - let - copy :: _ - copy w from = copy w 1 - in copy ws1 1 - In an equation for ‘foo’: - foo (Meta ws1) - = let - copy :: _ - copy w from = copy w 1 - in copy ws1 1 - -Trac10045.hs:7:9: error: - No instance for (Num a) - When checking that ‘copy’ has the inferred type - copy :: forall t t1 a. t -> a -> t1 - Probable cause: the inferred type is ambiguous - In the expression: - let - copy :: _ - copy w from = copy w 1 - in copy ws1 1 - In an equation for ‘foo’: - foo (Meta ws1) - = let - copy :: _ - copy w from = copy w 1 - in copy ws1 1 +
+Trac10045.hs:6:17: error:
+ Found type wildcard ‘_’ standing for ‘t1 -> a -> t2’
+ Where: ‘t1’ is a rigid type variable bound by
+ the inferred type of copy :: Num a => t1 -> a -> t2
+ at Trac10045.hs:7:9
+ ‘t2’ is a rigid type variable bound by
+ the inferred type of copy :: Num a => t1 -> a -> t2
+ at Trac10045.hs:7:9
+ ‘a’ is a rigid type variable bound by
+ the inferred type of copy :: Num a => t1 -> a -> t2
+ at Trac10045.hs:7:9
+ To use the inferred type, enable PartialTypeSignatures
+ Relevant bindings include
+ ws1 :: () (bound at Trac10045.hs:5:11)
+ foo :: Meta -> t (bound at Trac10045.hs:5:1)
+ In the type signature for:
+ copy :: _
+ In the expression:
+ let
+ copy :: _
+ copy w from = copy w 1
+ in copy ws1 1
+ In an equation for ‘foo’:
+ foo (Meta ws1)
+ = let
+ copy :: _
+ copy w from = copy w 1
+ in copy ws1 1
+
+Trac10045.hs:7:9: error:
+ No instance for (Num a)
+ When checking that ‘copy’ has the inferred type
+ copy :: forall t t1 a. t -> a -> t1
+ Probable cause: the inferred type is ambiguous
+ In the expression:
+ let
+ copy :: _
+ copy w from = copy w 1
+ in copy ws1 1
+ In an equation for ‘foo’:
+ foo (Meta ws1)
+ = let
+ copy :: _
+ copy w from = copy w 1
+ in copy ws1 1
diff --git a/testsuite/tests/partial-sigs/should_fail/WildcardInPatSynSig.stderr b/testsuite/tests/partial-sigs/should_fail/WildcardInPatSynSig.stderr index 9a4aca1429..7dd2a20a77 100644 --- a/testsuite/tests/partial-sigs/should_fail/WildcardInPatSynSig.stderr +++ b/testsuite/tests/partial-sigs/should_fail/WildcardInPatSynSig.stderr @@ -1,4 +1,5 @@ - -WildcardInPatSynSig.hs:4:37: - Unexpected wild card: ‘_’ - In the type signature for ‘Single’: Single :: _ -> [a] +
+WildcardInPatSynSig.hs:4:37: error:
+ Unexpected wild card: ‘_’
+ In the type signature for pattern synonym ‘Single’:
+ Single :: _ -> [a]
diff --git a/testsuite/tests/partial-sigs/should_fail/WildcardInstantiations.stderr b/testsuite/tests/partial-sigs/should_fail/WildcardInstantiations.stderr index b9442bb53c..d0d7dff480 100644 --- a/testsuite/tests/partial-sigs/should_fail/WildcardInstantiations.stderr +++ b/testsuite/tests/partial-sigs/should_fail/WildcardInstantiations.stderr @@ -1,45 +1,51 @@ - -WildcardInstantiations.hs:5:14: error: - Found type wildcard ‘_a’ standing for ‘w_a’ - Where: ‘w_a’ is a rigid type variable bound by - the inferred type of foo :: (Enum w_a, Show w_a) => w_a -> String - at WildcardInstantiations.hs:6:1 - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘foo’: (Show _a, _) => _a -> _ - -WildcardInstantiations.hs:5:18: error: - Found hole ‘_’ with inferred constraints: Enum w_a - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘foo’: (Show _a, _) => _a -> _ - -WildcardInstantiations.hs:5:30: error: - Found type wildcard ‘_’ standing for ‘String’ - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘foo’: (Show _a, _) => _a -> _ - -WildcardInstantiations.hs:8:8: error: - Found type wildcard ‘_’ standing for ‘w_’ - Where: ‘w_’ is a rigid type variable bound by - the inferred type of bar :: w_ -> (w_ -> w_1) -> w_1 - at WildcardInstantiations.hs:9:1 - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘bar’: _ -> _ -> _ - -WildcardInstantiations.hs:8:13: error: - Found type wildcard ‘_’ standing for ‘w_ -> w_1’ - Where: ‘w_’ is a rigid type variable bound by - the inferred type of bar :: w_ -> (w_ -> w_1) -> w_1 - at WildcardInstantiations.hs:9:1 - ‘w_1’ is a rigid type variable bound by - the inferred type of bar :: w_ -> (w_ -> w_1) -> w_1 - at WildcardInstantiations.hs:9:1 - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘bar’: _ -> _ -> _ - -WildcardInstantiations.hs:8:18: error: - Found type wildcard ‘_’ standing for ‘w_1’ - Where: ‘w_1’ is a rigid type variable bound by - the inferred type of bar :: w_ -> (w_ -> w_1) -> w_1 - at WildcardInstantiations.hs:9:1 - To use the inferred type, enable PartialTypeSignatures - In the type signature for ‘bar’: _ -> _ -> _ +
+WildcardInstantiations.hs:5:14: error:
+ Found type wildcard ‘_a’ standing for ‘a’
+ Where: ‘a’ is a rigid type variable bound by
+ the inferred type of foo :: (Enum a, Show a) => a -> String
+ at WildcardInstantiations.hs:6:1
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ foo :: (Show _a, _) => _a -> _
+
+WildcardInstantiations.hs:5:18: error:
+ Found hole ‘_’ with inferred constraints: Enum a
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ foo :: (Show _a, _) => _a -> _
+
+WildcardInstantiations.hs:5:30: error:
+ Found type wildcard ‘_’ standing for ‘String’
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ foo :: (Show _a, _) => _a -> _
+
+WildcardInstantiations.hs:8:8: error:
+ Found type wildcard ‘_’ standing for ‘t’
+ Where: ‘t’ is a rigid type variable bound by
+ the inferred type of bar :: t -> (t -> t1) -> t1
+ at WildcardInstantiations.hs:9:1
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ bar :: _ -> _ -> _
+
+WildcardInstantiations.hs:8:13: error:
+ Found type wildcard ‘_’ standing for ‘t -> t1’
+ Where: ‘t’ is a rigid type variable bound by
+ the inferred type of bar :: t -> (t -> t1) -> t1
+ at WildcardInstantiations.hs:9:1
+ ‘t1’ is a rigid type variable bound by
+ the inferred type of bar :: t -> (t -> t1) -> t1
+ at WildcardInstantiations.hs:9:1
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ bar :: _ -> _ -> _
+
+WildcardInstantiations.hs:8:18: error:
+ Found type wildcard ‘_’ standing for ‘t1’
+ Where: ‘t1’ is a rigid type variable bound by
+ the inferred type of bar :: t -> (t -> t1) -> t1
+ at WildcardInstantiations.hs:9:1
+ To use the inferred type, enable PartialTypeSignatures
+ In the type signature for:
+ bar :: _ -> _ -> _
diff --git a/testsuite/tests/partial-sigs/should_fail/WildcardsInPatternAndExprSig.stderr b/testsuite/tests/partial-sigs/should_fail/WildcardsInPatternAndExprSig.stderr index 90929b7c8f..97dacfe20a 100644 --- a/testsuite/tests/partial-sigs/should_fail/WildcardsInPatternAndExprSig.stderr +++ b/testsuite/tests/partial-sigs/should_fail/WildcardsInPatternAndExprSig.stderr @@ -1,74 +1,74 @@ - -WildcardsInPatternAndExprSig.hs:4:18: error: - Found type wildcard ‘_a’ standing for ‘w_c’ - Where: ‘w_c’ is a rigid type variable bound by - the inferred type of bar :: Maybe [w_c] -> w_c -> [w_c] - at WildcardsInPatternAndExprSig.hs:4:1 - To use the inferred type, enable PartialTypeSignatures - Relevant bindings include - bar :: Maybe [w_c] -> w_c -> [w_c] - (bound at WildcardsInPatternAndExprSig.hs:4:1) - In a pattern type signature: _a - In the pattern: x :: _a - In the pattern: [x :: _a] - -WildcardsInPatternAndExprSig.hs:4:25: error: - Found type wildcard ‘_’ standing for ‘[w_c]’ - Where: ‘w_c’ is a rigid type variable bound by - the inferred type of bar :: Maybe [w_c] -> w_c -> [w_c] - at WildcardsInPatternAndExprSig.hs:4:1 - To use the inferred type, enable PartialTypeSignatures - Relevant bindings include - bar :: Maybe [w_c] -> w_c -> [w_c] - (bound at WildcardsInPatternAndExprSig.hs:4:1) - In a pattern type signature: _ - In the pattern: [x :: _a] :: _ - In the pattern: Just ([x :: _a] :: _) - -WildcardsInPatternAndExprSig.hs:4:38: error: - Found type wildcard ‘_b’ standing for ‘w_c’ - Where: ‘w_c’ is a rigid type variable bound by - the inferred type of bar :: Maybe [w_c] -> w_c -> [w_c] - at WildcardsInPatternAndExprSig.hs:4:1 - To use the inferred type, enable PartialTypeSignatures - Relevant bindings include - bar :: Maybe [w_c] -> w_c -> [w_c] - (bound at WildcardsInPatternAndExprSig.hs:4:1) - In a pattern type signature: Maybe [_b] - In the pattern: Just ([x :: _a] :: _) :: Maybe [_b] - In an equation for ‘bar’: - bar (Just ([x :: _a] :: _) :: Maybe [_b]) (z :: _c) - = [x, z] :: [_d] - -WildcardsInPatternAndExprSig.hs:4:49: error: - Found type wildcard ‘_c’ standing for ‘w_c’ - Where: ‘w_c’ is a rigid type variable bound by - the inferred type of bar :: Maybe [w_c] -> w_c -> [w_c] - at WildcardsInPatternAndExprSig.hs:4:1 - To use the inferred type, enable PartialTypeSignatures - Relevant bindings include - x :: w_c (bound at WildcardsInPatternAndExprSig.hs:4:13) - bar :: Maybe [w_c] -> w_c -> [w_c] - (bound at WildcardsInPatternAndExprSig.hs:4:1) - In a pattern type signature: _c - In the pattern: z :: _c - In an equation for ‘bar’: - bar (Just ([x :: _a] :: _) :: Maybe [_b]) (z :: _c) - = [x, z] :: [_d] - -WildcardsInPatternAndExprSig.hs:4:66: error: - Found type wildcard ‘_d’ standing for ‘w_c’ - Where: ‘w_c’ is a rigid type variable bound by - the inferred type of bar :: Maybe [w_c] -> w_c -> [w_c] - at WildcardsInPatternAndExprSig.hs:4:1 - To use the inferred type, enable PartialTypeSignatures - Relevant bindings include - z :: w_c (bound at WildcardsInPatternAndExprSig.hs:4:44) - x :: w_c (bound at WildcardsInPatternAndExprSig.hs:4:13) - bar :: Maybe [w_c] -> w_c -> [w_c] - (bound at WildcardsInPatternAndExprSig.hs:4:1) - In an expression type signature: [_d] - In the expression: [x, z] :: [_d] - In an equation for ‘bar’: - bar (Just ([x :: _a] :: _) :: Maybe [_b]) (z :: _c) - = [x, z] :: [_d] +
+WildcardsInPatternAndExprSig.hs:4:18: error:
+ Found type wildcard ‘_a’ standing for ‘t’
+ Where: ‘t’ is a rigid type variable bound by
+ the inferred type of bar :: Maybe [t] -> t -> [t]
+ at WildcardsInPatternAndExprSig.hs:4:1
+ To use the inferred type, enable PartialTypeSignatures
+ Relevant bindings include
+ bar :: Maybe [t] -> t -> [t]
+ (bound at WildcardsInPatternAndExprSig.hs:4:1)
+ In a pattern type signature: _a
+ In the pattern: x :: _a
+ In the pattern: [x :: _a]
+
+WildcardsInPatternAndExprSig.hs:4:25: error:
+ Found type wildcard ‘_’ standing for ‘[t]’
+ Where: ‘t’ is a rigid type variable bound by
+ the inferred type of bar :: Maybe [t] -> t -> [t]
+ at WildcardsInPatternAndExprSig.hs:4:1
+ To use the inferred type, enable PartialTypeSignatures
+ Relevant bindings include
+ bar :: Maybe [t] -> t -> [t]
+ (bound at WildcardsInPatternAndExprSig.hs:4:1)
+ In a pattern type signature: _
+ In the pattern: [x :: _a] :: _
+ In the pattern: Just ([x :: _a] :: _)
+
+WildcardsInPatternAndExprSig.hs:4:38: error:
+ Found type wildcard ‘_b’ standing for ‘t’
+ Where: ‘t’ is a rigid type variable bound by
+ the inferred type of bar :: Maybe [t] -> t -> [t]
+ at WildcardsInPatternAndExprSig.hs:4:1
+ To use the inferred type, enable PartialTypeSignatures
+ Relevant bindings include
+ bar :: Maybe [t] -> t -> [t]
+ (bound at WildcardsInPatternAndExprSig.hs:4:1)
+ In a pattern type signature: Maybe [_b]
+ In the pattern: Just ([x :: _a] :: _) :: Maybe [_b]
+ In an equation for ‘bar’:
+ bar (Just ([x :: _a] :: _) :: Maybe [_b]) (z :: _c)
+ = [x, z] :: [_d]
+
+WildcardsInPatternAndExprSig.hs:4:49: error:
+ Found type wildcard ‘_c’ standing for ‘t’
+ Where: ‘t’ is a rigid type variable bound by
+ the inferred type of bar :: Maybe [t] -> t -> [t]
+ at WildcardsInPatternAndExprSig.hs:4:1
+ To use the inferred type, enable PartialTypeSignatures
+ Relevant bindings include
+ x :: t (bound at WildcardsInPatternAndExprSig.hs:4:13)
+ bar :: Maybe [t] -> t -> [t]
+ (bound at WildcardsInPatternAndExprSig.hs:4:1)
+ In a pattern type signature: _c
+ In the pattern: z :: _c
+ In an equation for ‘bar’:
+ bar (Just ([x :: _a] :: _) :: Maybe [_b]) (z :: _c)
+ = [x, z] :: [_d]
+
+WildcardsInPatternAndExprSig.hs:4:66: error:
+ Found type wildcard ‘_d’ standing for ‘t’
+ Where: ‘t’ is a rigid type variable bound by
+ the inferred type of bar :: Maybe [t] -> t -> [t]
+ at WildcardsInPatternAndExprSig.hs:4:1
+ To use the inferred type, enable PartialTypeSignatures
+ Relevant bindings include
+ z :: t (bound at WildcardsInPatternAndExprSig.hs:4:44)
+ x :: t (bound at WildcardsInPatternAndExprSig.hs:4:13)
+ bar :: Maybe [t] -> t -> [t]
+ (bound at WildcardsInPatternAndExprSig.hs:4:1)
+ In an expression type signature: [_d]
+ In the expression: [x, z] :: [_d]
+ In an equation for ‘bar’:
+ bar (Just ([x :: _a] :: _) :: Maybe [_b]) (z :: _c)
+ = [x, z] :: [_d]
diff --git a/testsuite/tests/typecheck/should_compile/T10072.stderr b/testsuite/tests/typecheck/should_compile/T10072.stderr index 8e05ebda32..ba15398874 100644 --- a/testsuite/tests/typecheck/should_compile/T10072.stderr +++ b/testsuite/tests/typecheck/should_compile/T10072.stderr @@ -1,8 +1,8 @@ - -T10072.hs:3:31: error: - Found type wildcard ‘_’ standing for ‘w_’ - Where: ‘w_’ is a rigid type variable bound by - the RULE "map/empty" at T10072.hs:3:1 - To use the inferred type, enable PartialTypeSignatures - In a RULE for ‘f’: a -> _ - When checking the transformation rule "map/empty" +
+T10072.hs:3:31: error:
+ Found type wildcard ‘_’ standing for ‘b’
+ Where: ‘b’ is a rigid type variable bound by
+ the RULE "map/empty" at T10072.hs:3:1
+ To use the inferred type, enable PartialTypeSignatures
+ In a RULE for ‘f’: a -> _
+ When checking the transformation rule "map/empty"
diff --git a/testsuite/tests/typecheck/should_fail/tcfail198.stderr b/testsuite/tests/typecheck/should_fail/tcfail198.stderr index 76557906ba..ea764fc846 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail198.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail198.stderr @@ -1,13 +1,13 @@ - -tcfail198.hs:6:36: - Couldn't match expected type ‘a1’ with actual type ‘a’ - because type variable ‘a1’ would escape its scope - This (rigid, skolem) type variable is bound by - an expression type signature: a1 - at tcfail198.hs:6:36-41 - Relevant bindings include - xs :: [a] (bound at tcfail198.hs:6:21) - x :: a (bound at tcfail198.hs:6:19) - f3 :: [a] -> [a] (bound at tcfail198.hs:6:6) - In the expression: x :: a - In the second argument of ‘(++)’, namely ‘[x :: a]’ +
+tcfail198.hs:6:36: error:
+ Couldn't match expected type ‘a2’ with actual type ‘a1’
+ because type variable ‘a2’ would escape its scope
+ This (rigid, skolem) type variable is bound by
+ an expression type signature: a2
+ at tcfail198.hs:6:36-41
+ Relevant bindings include
+ xs :: [a1] (bound at tcfail198.hs:6:21)
+ x :: a1 (bound at tcfail198.hs:6:19)
+ f3 :: [a1] -> [a1] (bound at tcfail198.hs:6:6)
+ In the expression: x :: a
+ In the second argument of ‘(++)’, namely ‘[x :: a]’
|