git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Include position info in errors
14b2310Phil Freeman
src/Language/PureScript/Parser/Common.hs+5
@@ -27,6 +27,11 @@ import Language.PureScript.Names
27
27
28import qualified Text.Parsec as P
28import qualified Text.Parsec as P
29
29
30+featureWasRemoved :: String -> TokenParser a
31+featureWasRemoved err = do
32+ pos <- P.getPosition
33+ error $ "It looks like you are trying to use a feature from a previous version of the compiler:\n" ++ err ++ "\nat " ++ show pos
34+
30properName :: TokenParser ProperName
35properName :: TokenParser ProperName
31properName = ProperName <$> uname
36properName = ProperName <$> uname
32
37
src/Language/PureScript/Parser/Declarations.hs+1−1
@@ -496,7 +496,7 @@ parseBinder :: TokenParser Binder
496parseBinder = withSourceSpan PositionedBinder (P.buildExpressionParser operators parseBinderAtom)
496parseBinder = withSourceSpan PositionedBinder (P.buildExpressionParser operators parseBinderAtom)
497 where
497 where
498 -- TODO: remove this deprecation warning in 0.8
498 -- TODO: remove this deprecation warning in 0.8
499− operators = [ [ P.Infix (P.try $ C.indented *> colon *> return (error "Cons binders are no longer supported. Consider using purescript-lists or purescript-sequences instead.")) P.AssocRight ] ]
499+ operators = [ [ P.Infix (P.try $ C.indented *> colon *> featureWasRemoved "Cons binders are no longer supported. Consider using purescript-lists or purescript-sequences instead.") P.AssocRight ] ]
500 parseBinderAtom :: TokenParser Binder
500 parseBinderAtom :: TokenParser Binder
501 parseBinderAtom = P.choice (map P.try
501 parseBinderAtom = P.choice (map P.try
502 [ parseNullBinder
502 [ parseNullBinder
src/Language/PureScript/Parser/Types.hs+2−2
@@ -36,12 +36,12 @@ import qualified Text.Parsec.Expr as P
36parseArray :: TokenParser Type
36parseArray :: TokenParser Type
37parseArray = do
37parseArray = do
38 _ <- squares $ return tyArray
38 _ <- squares $ return tyArray
39− return $ error "Array notation is no longer supported. Use Array instead of []."
39+ featureWasRemoved "Array notation is no longer supported. Use Array instead of []."
40
40
41parseArrayOf :: TokenParser Type
41parseArrayOf :: TokenParser Type
42parseArrayOf = do
42parseArrayOf = do
43 _ <- squares $ TypeApp tyArray <$> parseType
43 _ <- squares $ TypeApp tyArray <$> parseType
44− return $ error "Array notation is no longer supported. Use Array _ instead of [_]."
44+ featureWasRemoved "Array notation is no longer supported. Use Array _ instead of [_]."
45
45
46parseFunction :: TokenParser Type
46parseFunction :: TokenParser Type
47parseFunction = parens $ rarrow >> return tyFunction
47parseFunction = parens $ rarrow >> return tyFunction