Commit 3c9c4f0c authored by Björn Peemöller 's avatar Björn Peemöller
Browse files

Disallows nesting of lazy and functional patterns

parent eb6e5e7b
......@@ -590,8 +590,10 @@ checkPattern p (ListPattern pos ts) =
ListPattern pos <$> mapM (checkPattern p) ts
checkPattern p (AsPattern v t) = do
AsPattern <$> checkVar "@ pattern" v <*> checkPattern p t
checkPattern p (LazyPattern pos t) =
LazyPattern pos <$> checkPattern p t
checkPattern p (LazyPattern pos t) = do
t' <- checkPattern p t
banFPTerm "lazy pattern" p t'
return (LazyPattern pos t')
checkPattern _ (FunctionPattern _ _) = internalError $
"SyntaxCheck.checkPattern: function pattern not defined"
checkPattern _ (InfixFuncPattern _ _ _) = internalError $
......@@ -1022,8 +1024,8 @@ checkFPTerm p (ParenPattern t) = checkFPTerm p t
checkFPTerm p (TuplePattern _ ts) = mapM_ (checkFPTerm p) ts
checkFPTerm p (ListPattern _ ts) = mapM_ (checkFPTerm p) ts
checkFPTerm p (AsPattern _ t) = checkFPTerm p t
checkFPTerm p t@(LazyPattern _ _) = report $ errUnsupportedFPTerm "Lazy" p t
checkFPTerm p t@(RecordPattern _ _) = report $ errUnsupportedFPTerm "Record" p t
checkFPTerm p t@(LazyPattern _ _) = report $ errUnsupportedFPTerm "Lazy" p t
checkFPTerm _ (FunctionPattern _ _) = ok -- do not check again
checkFPTerm _ (InfixFuncPattern _ _ _) = ok -- do not check again
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment