summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2018-01-26 13:10:26 -0500
committerBen Gamari <ben@smart-cactus.org>2018-01-26 14:37:29 -0500
commit59fa7b32b018a91f81773ca676251a0b2761ef56 (patch)
tree7de1fd6fbc78e43dbae6bba706ab489b69bf27b2 /compiler
parenta55d581f8f2923560c3444253050b13fdf2dec10 (diff)
downloadhaskell-59fa7b32b018a91f81773ca676251a0b2761ef56.tar.gz
Fix #14719 by using the setting the right SrcSpan
Currently, error messages that germane to GADT constructors put the source span at only the first character in the constructor, leading to insufficient caret diagnostics. This can be easily fixed by using a source span that spans the entire constructor, instead of just the first character. Test Plan: make test TEST=T14719 Reviewers: alanz, bgamari, simonpj Reviewed By: alanz, simonpj Subscribers: simonpj, goldfire, rwbarton, thomie, carter GHC Trac Issues: #14719 Differential Revision: https://phabricator.haskell.org/D4344
Diffstat (limited to 'compiler')
-rw-r--r--compiler/typecheck/TcTyClsDecls.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs
index cd08570af6..7436b0d690 100644
--- a/compiler/typecheck/TcTyClsDecls.hs
+++ b/compiler/typecheck/TcTyClsDecls.hs
@@ -2538,8 +2538,8 @@ checkValidTyConTyVars tc
-------------------------------
checkValidDataCon :: DynFlags -> Bool -> TyCon -> DataCon -> TcM ()
checkValidDataCon dflags existential_ok tc con
- = setSrcSpan (srcLocSpan (getSrcLoc con)) $
- addErrCtxt (dataConCtxt con) $
+ = setSrcSpan (getSrcSpan con) $
+ addErrCtxt (dataConCtxt con) $
do { -- Check that the return type of the data constructor
-- matches the type constructor; eg reject this:
-- data T a where { MkT :: Bogus a }