From: Anders Mörtberg Date: Thu, 8 Jun 2017 07:46:27 +0000 (+0200) Subject: Check if some names were shadowed while loading the file X-Git-Url: https://git.ak3n.com/?a=commitdiff_plain;h=71a86bdf12e889b31bdec2cbb6822c18214485f7;p=cubicaltt.git Check if some names were shadowed while loading the file --- diff --git a/Main.hs b/Main.hs index c41c03e..fba67a9 100644 --- a/Main.hs +++ b/Main.hs @@ -98,10 +98,19 @@ initLoop flags f hist = do putStrLn $ "Resolver failed: " ++ err runInputT (settings []) (putHistory hist >> loop flags f [] TC.verboseEnv) Right (adefs,names) -> do + (merr,tenv) <- TC.runDeclss TC.verboseEnv adefs case merr of Just err -> putStrLn $ "Type checking failed: " ++ shrink err - Nothing -> putStrLn "File loaded." + Nothing -> do + putStrLn "File loaded." + -- After loading the file check if some definitions were shadowed: + let ns = map fst names + uns = nub ns + dups = ns \\ uns + unless (dups == []) $ + putStrLn $ "Warning: the following definitions were shadowed [" ++ + intercalate ", " dups ++ "]" if Batch `elem` flags then return () else -- Compute names for auto completion