@@ -60,7 +60,7 @@ elabData info syn doc argDocs fc opts (PLaterdecl n nfc t_in)
6060 = do let codata = Codata `elem` opts
6161 logElab 1 (show (fc, doc))
6262 checkUndefined fc n
63− when (implicitable n) $ warnLC fc n
63+ when (implicitable (nsroot n)) $ warnLC fc n
6464 (cty, _, t, inacc) <- buildType info syn fc [] n t_in
6565
6666 addIBC (IBCDef n)
@@ -71,7 +71,7 @@ elabData info syn doc argDocs fc opts (PDatadecl n nfc t_in dcons)
7171 = do let codata = Codata `elem` opts
7272 logElab 1 (show fc)
7373 undef <- isUndefined fc n
74− when (implicitable n) $ warnLC fc n
74+ when (implicitable (nsroot n)) $ warnLC fc n
7575 (cty, ckind, t, inacc) <- buildType info syn fc [] n t_in
7676 -- if n is defined already, make sure it is just a type declaration
7777 -- with the same type we've just elaborated, and no constructors
@@ -231,7 +231,7 @@ elabCon :: ElabInfo -> SyntaxInfo -> Name -> Bool ->
231231 Idris (Name, Type)
232232elabCon info syn tn codata expkind dkind (doc, argDocs, n, nfc, t_in, fc, forcenames)
233233 = do checkUndefined fc n
234− when (implicitable n) $ warnLC fc n
234+ when (implicitable (nsroot n)) $ warnLC fc n
235235 logElab 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ show t_in
236236 (cty, ckind, t, inacc) <- buildType info syn fc [Constructor] n (if codata then mkLazy t_in else t_in)
237237 ctxt <- getContext
@@ -261,7 +261,12 @@ elabCon info syn tn codata expkind dkind (doc, argDocs, n, nfc, t_in, fc, forcen
261261 addIBC (IBCOpt n)
262262 return (n, cty')
263263 where
264− tyIs con (Bind n b sc) = tyIs con sc
264+ tyIs con (Bind n b sc) = tyIs con (substV (P Bound n Erased) sc)
265+ tyIs con t | (P Bound n' _, _) <- unApply t
266+ = if n' /= tn then
267+ tclift $ tfail (At fc (Elaborating "constructor " con Nothing
268+ (Msg ("Type level variable " ++ show n' ++ " is not " ++ show tn))))
269+ else return ()
265270 tyIs con t | (P _ n' _, _) <- unApply t
266271 = if n' /= tn then tclift $ tfail (At fc (Elaborating "constructor " con Nothing (Msg (show n' ++ " is not " ++ show tn))))
267272 else return ()