Commit 600a1ac3 authored by Simon Peyton Jones's avatar Simon Peyton Jones Committed by Marge Bot

Add location to the extra-constraints wildcard

The extra-constraints wildcard had lost its location
(issue #16431).

Happily this is easy to fix.  Lots of error improvements.
parent 4927117c
Pipeline #3614 passed with stages
in 257 minutes and 39 seconds
......@@ -2479,7 +2479,7 @@ tcHsPartialSigType
, TcType ) -- Tau part
-- See Note [Recipe for checking a signature]
tcHsPartialSigType ctxt sig_ty
| HsWC { hswc_ext = sig_wcs, hswc_body = ib_ty } <- sig_ty
| HsWC { hswc_ext = sig_wcs, hswc_body = ib_ty } <- sig_ty
, HsIB { hsib_ext = implicit_hs_tvs
, hsib_body = hs_ty } <- ib_ty
, (explicit_hs_tvs, L _ hs_ctxt, hs_tau) <- splitLHsSigmaTy hs_ty
......@@ -2536,8 +2536,9 @@ tcHsPartialSigType _ (XHsWildCardBndrs _) = panic "tcHsPartialSigType"
tcPartialContext :: HsContext GhcRn -> TcM (TcThetaType, Maybe TcType)
tcPartialContext hs_theta
| Just (hs_theta1, hs_ctxt_last) <- snocView hs_theta
, L _ wc@(HsWildCardTy _) <- ignoreParens hs_ctxt_last
= do { wc_tv_ty <- tcWildCardOcc wc constraintKind
, L wc_loc wc@(HsWildCardTy _) <- ignoreParens hs_ctxt_last
= do { wc_tv_ty <- setSrcSpan wc_loc $
tcWildCardOcc wc constraintKind
; theta <- mapM tcLHsPredType hs_theta1
; return (theta, Just wc_tv_ty) }
| otherwise
......
SuperCls.hs:4:6: warning: [-Wpartial-type-signatures (in -Wdefault)]
SuperCls.hs:4:14: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘()’
• In the type signature: f :: (Ord a, _) => a -> Bool
T10519.hs:5:8: warning: [-Wpartial-type-signatures (in -Wdefault)]
T10519.hs:5:18: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘Eq a’
Where: ‘a’ is a rigid type variable bound by
the inferred type of foo :: Eq a => a -> a -> Bool
......
T11016.hs:5:7: warning: [-Wpartial-type-signatures (in -Wdefault)]
T11016.hs:5:19: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘()’
• In the type signature: f1 :: (?x :: Int, _) => Int
......
T12844.hs:12:8: warning: [-Wpartial-type-signatures (in -Wdefault)]
T12844.hs:12:9: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’
standing for ‘(Foo rngs, Head rngs ~ '(r, r'))’
Where: ‘rngs’, ‘k’, ‘r’, ‘k1’, ‘r'’
......
T12845.hs:18:11: warning: [-Wpartial-type-signatures (in -Wdefault)]
T12845.hs:18:70: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘()’
• In the type signature:
broken :: forall r r' rngs.
('(r, r') ~ Head rngs, Bar r r' ~ 'True, _) =>
('(r, r') ~ Head rngs, Bar r r' ~ 'True, _) =>
Foo r -> Proxy rngs -> ()
T13482.hs:10:20: warning: [-Wpartial-type-signatures (in -Wdefault)]
T13482.hs:10:32: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘(Eq m, Monoid m)’
Where: ‘m’ is a rigid type variable bound by
the inferred type of
......@@ -8,21 +8,21 @@ T13482.hs:10:20: warning: [-Wpartial-type-signatures (in -Wdefault)]
• In the type signature:
minimal1_noksig :: forall m. _ => Int -> Bool
T13482.hs:13:13: warning: [-Wpartial-type-signatures (in -Wdefault)]
T13482.hs:13:33: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘(Eq m, Monoid m)’
Where: ‘m’ is a rigid type variable bound by
the inferred type of minimal1 :: (Eq m, Monoid m) => Bool
at T13482.hs:14:1-41
• In the type signature: minimal1 :: forall (m :: Type). _ => Bool
T13482.hs:16:13: warning: [-Wpartial-type-signatures (in -Wdefault)]
T13482.hs:16:30: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘Monoid m’
Where: ‘m’ is a rigid type variable bound by
the inferred type of minimal2 :: (Eq m, Monoid m) => Bool
at T13482.hs:17:1-41
• In the type signature: minimal2 :: forall m. (Eq m, _) => Bool
T13482.hs:19:13: warning: [-Wpartial-type-signatures (in -Wdefault)]
T13482.hs:19:34: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘Eq m’
Where: ‘m’ is a rigid type variable bound by
the inferred type of minimal3 :: (Monoid m, Eq m) => Bool
......
T14217.hs:32:10: error:
T14217.hs:32:11: error:
• Found type wildcard ‘_’
standing for ‘(Eq a1, Eq a2, Eq a3, Eq a4, Eq a5, Eq a6, Eq a7,
Eq a8, Eq a9, Eq a10, Eq a11, Eq a12, Eq a13, Eq a14, Eq a15,
......
T14643.hs:5:11: warning: [-Wpartial-type-signatures (in -Wdefault)]
T14643.hs:5:18: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘()’
• In the type signature: af :: (Num a, _) => a -> a
T14643.hs:5:11: warning: [-Wpartial-type-signatures (in -Wdefault)]
T14643.hs:5:18: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘()’
• In the type signature: ag :: (Num a, _) => a -> a
T14643a.hs:5:7: warning: [-Wpartial-type-signatures (in -Wdefault)]
T14643a.hs:5:14: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘()’
• In the type signature: af :: (Num a, _) => a -> a
T14643a.hs:8:7: warning: [-Wpartial-type-signatures (in -Wdefault)]
T14643a.hs:8:14: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘()’
• In the type signature: ag :: (Num a, _) => a -> a
T14715.hs:13:20: warning: [-Wpartial-type-signatures (in -Wdefault)]
T14715.hs:13:53: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘Reduce (LiftOf zq) zq’
Where: ‘zq’ is a rigid type variable bound by
the inferred type of
......
......@@ -5,15 +5,15 @@ Dependent modules: []
Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3,
integer-gmp-1.0.2.0]
WarningWildcardInstantiations.hs:5:8: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘Enum a’
WarningWildcardInstantiations.hs:5:14: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_a’ standing for ‘a’
Where: ‘a’ is a rigid type variable bound by
the inferred type of foo :: (Show a, Enum a) => a -> String
at WarningWildcardInstantiations.hs:6:1-21
• In the type signature: foo :: (Show _a, _) => _a -> _
WarningWildcardInstantiations.hs:5:14: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_a’ standing for ‘a’
WarningWildcardInstantiations.hs:5:18: warning: [-Wpartial-type-signatures (in -Wdefault)]
• Found type wildcard ‘_’ standing for ‘Enum a’
Where: ‘a’ is a rigid type variable bound by
the inferred type of foo :: (Show a, Enum a) => a -> String
at WarningWildcardInstantiations.hs:6:1-21
......
InstantiatedNamedWildcardsInConstraints.hs:4:8: error:
• Found type wildcard ‘_’ standing for ‘Show 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:5:1-26
To use the inferred type, enable PartialTypeSignatures
• In the type signature: foo :: (Enum _a, _) => _a -> (String, b)
InstantiatedNamedWildcardsInConstraints.hs:4:14: error:
• Found type wildcard ‘_a’ standing for ‘b’
InstantiatedNamedWildcardsInConstraints.hs:4:18: error:
• Found type wildcard ‘_’ standing for ‘Show 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:5:1-26
......
T11515.hs:7:8: error:
T11515.hs:7:20: error:
• Found type wildcard ‘_’ standing for ‘()’
To use the inferred type, enable PartialTypeSignatures
• In the type signature: foo :: (ShowSyn a, _) => a -> String
WildcardInstantiations.hs:5:8: error:
• Found type wildcard ‘_’ standing for ‘Enum a’
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 :: (Show a, Enum a) => a -> String
at WildcardInstantiations.hs:6:1-21
To use the inferred type, enable PartialTypeSignatures
• In the type signature: foo :: (Show _a, _) => _a -> _
WildcardInstantiations.hs:5:14: error:
• Found type wildcard ‘_a’ standing for ‘a’
WildcardInstantiations.hs:5:18: error:
• Found type wildcard ‘_’ standing for ‘Enum a’
Where: ‘a’ is a rigid type variable bound by
the inferred type of foo :: (Show a, Enum a) => a -> String
at WildcardInstantiations.hs:6:1-21
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment