diff options
Diffstat (limited to 'compiler/parser')
-rw-r--r-- | compiler/parser/Lexer.x | 2 | ||||
-rw-r--r-- | compiler/parser/Parser.y | 15 |
2 files changed, 6 insertions, 11 deletions
diff --git a/compiler/parser/Lexer.x b/compiler/parser/Lexer.x index a99a62913e..1536b85bca 100644 --- a/compiler/parser/Lexer.x +++ b/compiler/parser/Lexer.x @@ -940,7 +940,7 @@ One might think that we wish to treat 'family' and 'role' as regular old varids whenever -XTypeFamilies and -XRoleAnnotations are off, respectively. But, there is no need to do so. These pseudo-keywords are not stolen syntax: they are only used after the keyword 'type' at the top-level, where varids are -not allowed. Furthermore, checks further downstream (TcTyClsDecls) ensure that +not allowed. Furthermore, checks further downstream (GHC.Tc.TyCl) ensure that type families and role annotations are never declared without their extensions on. In fact, by unconditionally lexing these pseudo-keywords as special, we can get better error messages. diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y index e87cad6dae..842a912b0e 100644 --- a/compiler/parser/Parser.y +++ b/compiler/parser/Parser.y @@ -44,10 +44,9 @@ import Control.Monad ( mplus ) import Control.Applicative ((<$)) import qualified Prelude --- compiler/hsSyn +-- compiler import GHC.Hs --- compiler/main import GHC.Driver.Phases ( HscSource(..) ) import GHC.Driver.Types ( IsBootInterface, WarningTxt(..) ) import GHC.Driver.Session @@ -60,6 +59,8 @@ import BooleanFormula ( BooleanFormula(..), LBooleanFormula(..), mkTrue ) import FastString import Maybes ( isJust, orElse ) import Outputable +import Util ( looksLikePackageName, fstOf3, sndOf3, thdOf3 ) +import GhcPrelude -- compiler/basicTypes import GHC.Types.Name.Reader @@ -68,8 +69,8 @@ import GHC.Core.DataCon ( DataCon, dataConName ) import GHC.Types.SrcLoc import GHC.Types.Module import GHC.Types.Basic +import GHC.Types.ForeignCall --- compiler/types import GHC.Core.Type ( funTyCon ) import GHC.Core.Class ( FunDep ) @@ -79,19 +80,13 @@ import Lexer import HaddockUtils import ApiAnnotation --- compiler/typecheck -import TcEvidence ( emptyTcEvBinds ) +import GHC.Tc.Types.Evidence ( emptyTcEvBinds ) -- compiler/prelude -import GHC.Types.ForeignCall import TysPrim ( eqPrimTyCon ) import TysWiredIn ( unitTyCon, unitDataCon, tupleTyCon, tupleDataCon, nilDataCon, unboxedUnitTyCon, unboxedUnitDataCon, listTyCon_RDR, consDataCon_RDR, eqTyCon_RDR ) - --- compiler/utils -import Util ( looksLikePackageName, fstOf3, sndOf3, thdOf3 ) -import GhcPrelude } %expect 232 -- shift/reduce conflicts |