Commit c5719bed authored by Finn Teegen's avatar Finn Teegen
Browse files

Consider data constructors when checking for duplicate definitions

Fix #24
parent c0a5efbc
......@@ -74,8 +74,8 @@ import Env.Value (ValueEnv, ValueInfo (..))
syntaxCheck :: [KnownExtension] -> TCEnv -> ValueEnv -> Module ()
-> ((Module (), [KnownExtension]), [Message])
syntaxCheck exts tcEnv vEnv mdl@(Module _ m _ _ ds) =
case findMultiples $ concatMap constrs tds of
[] -> case findMultiples (ls ++ fs ++ cs) of
case findMultiples cons of
[] -> case findMultiples (ls ++ fs ++ cons ++ cs) of
[] -> runSC (checkModule mdl) state
iss -> ((mdl, exts), map (errMultipleDeclarations m) iss)
css -> ((mdl, exts), map errMultipleDataConstructor css)
......@@ -83,6 +83,7 @@ syntaxCheck exts tcEnv vEnv mdl@(Module _ m _ _ ds) =
tds = filter isTypeDecl ds
vds = filter isValueDecl ds
cds = filter isClassDecl ds
cons = concatMap constrs tds
ls = nub $ concatMap recLabels tds
fs = nub $ concatMap vars vds
cs = concatMap (concatMap methods) $ [ds' | ClassDecl _ _ _ _ ds' <- cds]
......
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