From b094274c0e6e0218977a65821066a3970254810a Mon Sep 17 00:00:00 2001 From: hallgren Date: Tue, 26 Jun 2012 14:46:18 +0000 Subject: Report many type errors instead of stopping after the first one In GF.Compile.CheckGrammar, use a new topological sorting function that groups independent judgements, allowing them all to be checked before continuing or reporting errors. --- src/compiler/GF/Grammar/Macros.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/compiler/GF/Grammar') diff --git a/src/compiler/GF/Grammar/Macros.hs b/src/compiler/GF/Grammar/Macros.hs index e8842375d..bf7e7047b 100644 --- a/src/compiler/GF/Grammar/Macros.hs +++ b/src/compiler/GF/Grammar/Macros.hs @@ -568,10 +568,20 @@ allDependencies ism b = topoSortJments :: SourceModule -> Err [(Ident,Info)] topoSortJments (m,mi) = do is <- either - return + return (\cyc -> Bad (render (text "circular definitions:" <+> fsep (map ppIdent (head cyc))))) (topoTest (allDependencies (==m) (jments mi))) return (reverse [(i,info) | i <- is, Ok info <- [lookupTree showIdent i (jments mi)]]) + +topoSortJments2 :: SourceModule -> Err [[(Ident,Info)]] +topoSortJments2 (m,mi) = do + iss <- either + return + (\cyc -> fail (render (text "circular definitions:" + <+> fsep (map ppIdent (head cyc))))) + (topoTest2 (allDependencies (==m) (jments mi))) + return + [[(i,info) | i<-is,Ok info<-[lookupTree showIdent i (jments mi)]] | is<-iss] {- -- | Smart constructor for PSeq pSeq p1 p2 = -- cgit v1.2.3