@@ -46,7 +46,7 @@ simplify :: Bool -> DExp -> State (DDefs, Int) SExp
4646simplify tl (DV (Loc i)) = return (SV (Loc i))
4747simplify tl (DV (Glob x))
4848 = do ctxt <- ldefs
49− case lookupCtxt x ctxt of
49+ case lookupCtxtExact x ctxt of
5050 [DConstructor _ t 0] -> return $ SCon t x []
5151 _ -> return $ SV (Glob x)
5252simplify tl (DApp tc n args) = do args' <- mapM sVar args
@@ -88,7 +88,7 @@ simplify tl (DError str) = return $ SError str
8888
8989sVar (DV (Glob x))
9090 = do ctxt <- ldefs
91− case lookupCtxt x ctxt of
91+ case lookupCtxtExact x ctxt of
9292 [DConstructor _ t 0] -> sVar (DC t x [])
9393 _ -> return (Glob x, Nothing)
9494sVar (DV x) = return (x, Nothing)
@@ -136,7 +136,7 @@ scopecheck ctxt envTop tm = sc envTop tm where
136136 sc env (SV (Glob n)) =
137137 case lookup n (reverse env) of -- most recent first
138138 Just i -> do lvar i; return (SV (Loc i))
139− Nothing -> case lookupCtxt n ctxt of
139+ Nothing -> case lookupCtxtExact n ctxt of
140140 [DConstructor _ i ar] ->
141141 if True -- ar == 0
142142 then return (SCon i n [])
@@ -146,7 +146,7 @@ scopecheck ctxt envTop tm = sc envTop tm where
146146 [] -> fail $ "Codegen error: No such variable " ++ show n
147147 sc env (SApp tc f args)
148148 = do args' <- mapM (scVar env) args
149− case lookupCtxt f ctxt of
149+ case lookupCtxtExact f ctxt of
150150 [DConstructor n tag ar] ->
151151 if True -- (ar == length args)
152152 then return $ SCon tag n args'
@@ -160,7 +160,7 @@ scopecheck ctxt envTop tm = sc envTop tm where
160160 return $ SForeign l ty f args'
161161 sc env (SCon tag f args)
162162 = do args' <- mapM (scVar env) args
163− case lookupCtxt f ctxt of
163+ case lookupCtxtExact f ctxt of
164164 [DConstructor n tag ar] ->
165165 if True -- (ar == length args)
166166 then return $ SCon tag n args'
@@ -197,7 +197,7 @@ scopecheck ctxt envTop tm = sc envTop tm where
197197 scVar env (Glob n) =
198198 case lookup n (reverse env) of -- most recent first
199199 Just i -> do lvar i; return (Loc i)
200− Nothing -> case lookupCtxt n ctxt of
200+ Nothing -> case lookupCtxtExact n ctxt of
201201 [DConstructor _ i ar] ->
202202 fail $ "Codegen error : can't pass constructor here"
203203 [_] -> return (Glob n)
@@ -207,7 +207,7 @@ scopecheck ctxt envTop tm = sc envTop tm where
207207
208208 scalt env (SConCase _ i n args e)
209209 = do let env' = env ++ zip args [length env..]
210− tag <- case lookupCtxt n ctxt of
210+ tag <- case lookupCtxtExact n ctxt of
211211 [DConstructor _ i ar] ->
212212 if True -- (length args == ar)
213213 then return i