diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-10-19 10:21:28 -0400 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-10-19 10:21:28 -0400 |
commit | 8846a7fdcf2060dd37e66b4d1f89bd8fdfad4620 (patch) | |
tree | cec0f07241fb1b9b1fcc225dfba26772802abb89 /compiler | |
parent | 101a8c770b9d3abd57ff289bffea3d838cf25c80 (diff) | |
download | haskell-8846a7fdcf2060dd37e66b4d1f89bd8fdfad4620.tar.gz |
Fix #14369 by making injectivity warnings finer-grained
Summary:
Previously, GHC would always raise the possibility that a
type family might not be injective in certain error messages, even if
that type family actually //was// injective. Fix this by actually
checking for a type family's lack of injectivity before emitting
such an error message.
Test Plan: ./validate
Reviewers: goldfire, austin, bgamari, simonpj
Reviewed By: simonpj
Subscribers: simonpj, rwbarton, thomie
GHC Trac Issues: #14369
Differential Revision: https://phabricator.haskell.org/D4106
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/typecheck/TcErrors.hs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs index 525c6fbd72..0c6b54d1ff 100644 --- a/compiler/typecheck/TcErrors.hs +++ b/compiler/typecheck/TcErrors.hs @@ -1830,8 +1830,9 @@ mkEqInfoMsg ct ty1 ty2 tyfun_msg | Just tc1 <- mb_fun1 , Just tc2 <- mb_fun2 , tc1 == tc2 + , not (isInjectiveTyCon tc1 Nominal) = text "NB:" <+> quotes (ppr tc1) - <+> text "is a type function, and may not be injective" + <+> text "is a non-injective type family" | otherwise = empty isUserSkolem :: ReportErrCtxt -> TcTyVar -> Bool |