
Sjoerd Visscher pushed to branch wip/T18570 at Glasgow Haskell Compiler / GHC Commits: 4104fade by Sjoerd Visscher at 2025-06-25T15:00:12+02:00 Fix hole fits - - - - - 3 changed files: - compiler/GHC/Tc/Errors/Ppr.hs - testsuite/tests/overloadedrecflds/should_fail/DRFHoleFits.stderr - testsuite/tests/overloadedrecflds/should_fail/T23063.stderr Changes: ===================================== compiler/GHC/Tc/Errors/Ppr.hs ===================================== @@ -3541,12 +3541,12 @@ pprHoleFit :: HoleFitDispConfig -> HoleFit -> SDoc pprHoleFit _ (RawHoleFit sd) = sd pprHoleFit (HFDC sWrp sWrpVars sTy sProv sMs) (TcHoleFit (HoleFit {..})) = hang display 2 provenance - where tyApp = sep $ zipWithEqual pprArg vars hfWrap + where tyApps = concat $ zipWithEqual pprArg vars hfWrap where pprArg b arg = case binderFlag b of - Specified -> text "@" <> pprParendType arg + Specified -> [text "@" <> pprParendType arg] -- Do not print type application for inferred -- variables (#16456) - Inferred -> empty + Inferred -> [] Required -> pprPanic "pprHoleFit: bad Required" (ppr b <+> ppr arg) tyAppVars = sep $ punctuate comma $ @@ -3573,9 +3573,9 @@ pprHoleFit (HFDC sWrp sWrpVars sTy sProv sMs) (TcHoleFit (HoleFit {..})) = IdHFCand id_ -> pprPrefixOcc id_ tyDisp = ppWhen sTy $ dcolon <+> ppr hfType has = not . null - wrapDisp = ppWhen (has hfWrap && (sWrp || sWrpVars)) + wrapDisp = ppWhen (has tyApps && (sWrp || sWrpVars)) $ text "with" <+> if sWrp || not sTy - then occDisp <+> tyApp + then occDisp <+> sep tyApps else tyAppVars docs = case hfDoc of Just d -> pprHsDocStrings d ===================================== testsuite/tests/overloadedrecflds/should_fail/DRFHoleFits.stderr ===================================== @@ -6,9 +6,7 @@ DRFHoleFits.hs:7:7: error: [GHC-88464] bar :: T -> Int (bound at DRFHoleFits.hs:7:1) Valid hole fits include bar :: T -> Int (defined at DRFHoleFits.hs:7:1) - foo :: T -> Int - with foo - (defined at DRFHoleFits.hs:5:16) + foo :: T -> Int (defined at DRFHoleFits.hs:5:16) DRFHoleFits.hs:8:7: error: [GHC-88464] • Found hole: _ :: A.S -> Int @@ -19,7 +17,6 @@ DRFHoleFits.hs:8:7: error: [GHC-88464] Valid hole fits include baz :: A.S -> Int (defined at DRFHoleFits.hs:8:1) A.foo :: A.S -> Int - with A.foo (imported qualified from ‘DRFHoleFits_A’ at DRFHoleFits.hs:3:1-35 (and originally defined at DRFHoleFits_A.hs:5:16-18)) ===================================== testsuite/tests/overloadedrecflds/should_fail/T23063.stderr ===================================== @@ -7,7 +7,6 @@ T23063.hs:5:7: error: [GHC-88464] Valid hole fits include baz :: A.S -> Int (defined at T23063.hs:5:1) A.foo :: A.S -> Int - with A.foo (imported qualified from ‘T23063_aux’ at T23063.hs:3:1-32 (and originally defined at T23063_aux.hs:4:16-18)) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4104fade70e76afdfb109d68e2819c99... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4104fade70e76afdfb109d68e2819c99... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Sjoerd Visscher (@trac-sjoerd_visscher)