summaryrefslogtreecommitdiff
path: root/compiler/GHC/Types
diff options
context:
space:
mode:
authorAndrei Borzenkov <andreyborzenkov2002@gmail.com>2023-01-26 15:04:47 +0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-01-27 05:02:07 -0500
commit2648c09cd3caefbcb5febd41867347b81cd94e47 (patch)
treeacb584371962e2c0da04c708a11eab0b91f66928 /compiler/GHC/Types
parente480fbc2c6fdcb252847fc537ab7ec50d1dc2dfd (diff)
downloadhaskell-2648c09cd3caefbcb5febd41867347b81cd94e47.tar.gz
Replace errors from badOrigBinding with new one (#22839)
Problem: in 02279a9c the type-level [] syntax was changed from a built-in name to an alias for the GHC.Types.List constructor. badOrigBinding assumes that if a name is not built-in then it must have come from TH quotation, but this is not necessarily the case with []. The outdated assumption in badOrigBinding leads to incorrect error messages. This code: data [] Fails with "Cannot redefine a Name retrieved by a Template Haskell quote: []" Unfortunately, there is not enough information in RdrName to directly determine if the name was constructed via TH or by the parser, so this patch changes the error message instead. It unifies TcRnIllegalBindingOfBuiltIn and TcRnNameByTemplateHaskellQuote into a new error TcRnBindingOfExistingName and changes its wording to avoid guessing the origin of the name.
Diffstat (limited to 'compiler/GHC/Types')
-rw-r--r--compiler/GHC/Types/Error/Codes.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/GHC/Types/Error/Codes.hs b/compiler/GHC/Types/Error/Codes.hs
index 544ebc905f..c46320da0d 100644
--- a/compiler/GHC/Types/Error/Codes.hs
+++ b/compiler/GHC/Types/Error/Codes.hs
@@ -468,8 +468,6 @@ type family GhcDiagnosticCode c = n | n -> c where
GhcDiagnosticCode "TcRnNonOverloadedSpecialisePragma" = 35827
GhcDiagnosticCode "TcRnSpecialiseNotVisible" = 85337
GhcDiagnosticCode "TcRnIllegalTypeOperatorDecl" = 50649
- GhcDiagnosticCode "TcRnNameByTemplateHaskellQuote" = 40027
- GhcDiagnosticCode "TcRnIllegalBindingOfBuiltIn" = 69639
GhcDiagnosticCode "TcRnIllegalHsigDefaultMethods" = 93006
GhcDiagnosticCode "TcRnBadGenericMethod" = 59794
@@ -502,6 +500,7 @@ type family GhcDiagnosticCode c = n | n -> c where
GhcDiagnosticCode "TcRnBadFamInstDecl" = 06206
GhcDiagnosticCode "TcRnNotOpenFamily" = 06207
GhcDiagnosticCode "TcRnCapturedTermName" = 54201
+ GhcDiagnosticCode "TcRnBindingOfExistingName" = 58805
-- IllegalNewtypeReason
GhcDiagnosticCode "DoesNotHaveSingleField" = 23517
@@ -607,6 +606,8 @@ type family GhcDiagnosticCode c = n | n -> c where
-- no longer reports. These are collected below.
GhcDiagnosticCode "Example outdated error" = 00000
+ GhcDiagnosticCode "TcRnNameByTemplateHaskellQuote" = 40027
+ GhcDiagnosticCode "TcRnIllegalBindingOfBuiltIn" = 69639
{- *********************************************************************
* *