From 71a86bdf12e889b31bdec2cbb6822c18214485f7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Anders=20M=C3=B6rtberg?= Date: Thu, 8 Jun 2017 09:46:27 +0200 Subject: [PATCH] Check if some names were shadowed while loading the file --- Main.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 -- 2.34.1