summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2017-10-19 10:21:28 -0400
committerRyan Scott <ryan.gl.scott@gmail.com>2017-10-19 10:21:28 -0400
commit8846a7fdcf2060dd37e66b4d1f89bd8fdfad4620 (patch)
treecec0f07241fb1b9b1fcc225dfba26772802abb89 /compiler
parent101a8c770b9d3abd57ff289bffea3d838cf25c80 (diff)
downloadhaskell-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.hs3
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