[Git][ghc/ghc][wip/ani/no-ds-flag-cache] Fix an oversight in getDeepSubsumptionFlag
Simon Peyton Jones pushed to branch wip/ani/no-ds-flag-cache at Glasgow Haskell Compiler / GHC Commits: 3418bdba by Simon Peyton Jones at 2026-03-31T11:08:47+01:00 Fix an oversight in getDeepSubsumptionFlag - - - - - 1 changed file: - compiler/GHC/Tc/Gen/App.hs Changes: ===================================== compiler/GHC/Tc/Gen/App.hs ===================================== @@ -350,7 +350,7 @@ Unify result type /before/ typechecking the args The latter is much better. That is why we call `checkResultTy` before tcValArgs. -} --- CAUTION: Any changes to tcApp should be reflected in tcExprSigma + tcApp :: HsExpr GhcRn -> ExpRhoType -- When checking, -XDeepSubsumption <=> deeply skolemised -> TcM (HsExpr GhcTc) @@ -459,11 +459,15 @@ checkResultTy :: HsExpr GhcRn -- expose foralls, but maybe not /deeply/ instantiated -> ExpRhoType -- Expected type; this is deeply skolemised -> TcM HsWrapper -checkResultTy rn_expr _ _ app_res_rho (Infer inf_res) - = do { ds_flag <- getDeepSubsumptionFlag +checkResultTy rn_expr (tc_fun,_) _ app_res_rho (Infer inf_res) + = do { ds_flag <- getDeepSubsumptionFlag_DataConHead tc_fun + -- We must deeply-instantiate data constructors + -- E.g. data T = MkT Int int + -- f = K 3 + -- We must infer f :: Int ->{many} T + -- and not f :: Int ->{one} T ; fillInferResult ds_flag (exprCtOrigin rn_expr) app_res_rho inf_res } - checkResultTy rn_expr (tc_fun, fun_loc) inst_args app_res_rho (Check res_ty) -- Unify with expected type from the context -- See Note [Unify with expected type before typechecking arguments] View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3418bdbadd44cd7bf8b7cb47cf912c23... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3418bdbadd44cd7bf8b7cb47cf912c23... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Peyton Jones (@simonpj)