git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Include position info in errors
commit14b2310aa6d9681e70e87991410bd664f1d0fbfa authorPhil Freeman <paf31@cantab.net> dateTue 28 Apr 2015, 16:16 (12 years ago) parent1f94f12
3 files changed+8−3
src/Language/PureScript/Parser/Common.hs+5 src/Language/PureScript/Parser/Declarations.hs+1−1 src/Language/PureScript/Parser/Types.hs+2−2
src/Language/PureScript/Parser/Common.hs+5
@@ -27,6 +27,11 @@ import Language.PureScript.Names
2727
2828import qualified Text.Parsec as P
2929
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+
3035properName :: TokenParser ProperName
3136properName = ProperName <$> uname
3237
src/Language/PureScript/Parser/Declarations.hs+1−1
@@ -496,7 +496,7 @@ parseBinder :: TokenParser Binder
496496parseBinder = withSourceSpan PositionedBinder (P.buildExpressionParser operators parseBinderAtom)
497497 where
498498 -- 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 ] ]
500500 parseBinderAtom :: TokenParser Binder
501501 parseBinderAtom = P.choice (map P.try
502502 [ parseNullBinder
src/Language/PureScript/Parser/Types.hs+2−2
@@ -36,12 +36,12 @@ import qualified Text.Parsec.Expr as P
3636parseArray :: TokenParser Type
3737parseArray = do
3838 _ <- 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 []."
4040
4141parseArrayOf :: TokenParser Type
4242parseArrayOf = do
4343 _ <- 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 [_]."
4545
4646parseFunction :: TokenParser Type
4747parseFunction = parens $ rarrow >> return tyFunction