summaryrefslogtreecommitdiff
path: root/compiler/hsSyn
diff options
context:
space:
mode:
authorRichard Eisenberg <eir@cis.upenn.edu>2014-11-03 15:34:53 -0500
committerRichard Eisenberg <eir@cis.upenn.edu>2014-11-21 11:15:46 -0500
commitda2fca9e2be8c61c91c034d8c2302d8b1d1e7b41 (patch)
treeccc30f5a5b1d8ff4cc1ef66cfec4499bb28846d8 /compiler/hsSyn
parentdbf360a5264d5d6597e046dcd9b4f49effa91eee (diff)
downloadhaskell-da2fca9e2be8c61c91c034d8c2302d8b1d1e7b41.tar.gz
Fix #7484, checking for good binder names in Convert.
This commit also refactors a bunch of lexeme-oriented code into a new module Lexeme, and includes a submodule update for haddock.
Diffstat (limited to 'compiler/hsSyn')
-rw-r--r--compiler/hsSyn/Convert.lhs14
1 files changed, 6 insertions, 8 deletions
diff --git a/compiler/hsSyn/Convert.lhs b/compiler/hsSyn/Convert.lhs
index 83c286d4dc..141b8b840a 100644
--- a/compiler/hsSyn/Convert.lhs
+++ b/compiler/hsSyn/Convert.lhs
@@ -30,6 +30,7 @@ import ForeignCall
import Unique
import ErrUtils
import Bag
+import Lexeme
import Util
import FastString
import Outputable
@@ -1122,14 +1123,11 @@ cvtName ctxt_ns (TH.Name occ flavour)
occ_str = TH.occString occ
okOcc :: OccName.NameSpace -> String -> Bool
-okOcc _ [] = False
-okOcc ns str@(c:_)
- | OccName.isVarNameSpace ns = startsVarId c || startsVarSym c
- | OccName.isDataConNameSpace ns = startsConId c || startsConSym c || str == "[]"
- | otherwise = startsConId c || startsConSym c ||
- startsVarSym c || str == "[]" || str == "->"
- -- allow type operators like "+"
-
+okOcc ns str
+ | OccName.isVarNameSpace ns = okVarOcc str
+ | OccName.isDataConNameSpace ns = okConOcc str
+ | otherwise = okTcOcc str
+
-- Determine the name space of a name in a type
--
isVarName :: TH.Name -> Bool