@@ -60,7 +60,7 @@ elabData info syn doc argDocs fc opts (PLaterdecl n nfc t_in)
60 = do let codata = Codata `elem` opts
60 = do let codata = Codata `elem` opts
61 logElab 1 (show (fc, doc))
61 logElab 1 (show (fc, doc))
62 checkUndefined fc n
62 checkUndefined fc n
63− when (implicitable n) $ warnLC fc n
63+ when (implicitable (nsroot n)) $ warnLC fc n
64 (cty, _, t, inacc) <- buildType info syn fc [] n t_in
64 (cty, _, t, inacc) <- buildType info syn fc [] n t_in
66 addIBC (IBCDef n)
66 addIBC (IBCDef n)
@@ -71,7 +71,7 @@ elabData info syn doc argDocs fc opts (PDatadecl n nfc t_in dcons)
71 = do let codata = Codata `elem` opts
71 = do let codata = Codata `elem` opts
72 logElab 1 (show fc)
72 logElab 1 (show fc)
73 undef <- isUndefined fc n
73 undef <- isUndefined fc n
74− when (implicitable n) $ warnLC fc n
74+ when (implicitable (nsroot n)) $ warnLC fc n
75 (cty, ckind, t, inacc) <- buildType info syn fc [] n t_in
75 (cty, ckind, t, inacc) <- buildType info syn fc [] n t_in
76 -- if n is defined already, make sure it is just a type declaration
76 -- if n is defined already, make sure it is just a type declaration
77 -- with the same type we've just elaborated, and no constructors
77 -- with the same type we've just elaborated, and no constructors
@@ -231,7 +231,7 @@ elabCon :: ElabInfo -> SyntaxInfo -> Name -> Bool ->
231 Idris (Name, Type)
231 Idris (Name, Type)
232elabCon info syn tn codata expkind dkind (doc, argDocs, n, nfc, t_in, fc, forcenames)
232elabCon info syn tn codata expkind dkind (doc, argDocs, n, nfc, t_in, fc, forcenames)
233 = do checkUndefined fc n
233 = do checkUndefined fc n
234− when (implicitable n) $ warnLC fc n
234+ when (implicitable (nsroot n)) $ warnLC fc n
235 logElab 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ show t_in
235 logElab 2 $ show fc ++ ":Constructor " ++ show n ++ " : " ++ show t_in
236 (cty, ckind, t, inacc) <- buildType info syn fc [Constructor] n (if codata then mkLazy t_in else t_in)
236 (cty, ckind, t, inacc) <- buildType info syn fc [Constructor] n (if codata then mkLazy t_in else t_in)
237 ctxt <- getContext
237 ctxt <- getContext
@@ -261,7 +261,12 @@ elabCon info syn tn codata expkind dkind (doc, argDocs, n, nfc, t_in, fc, forcen
261 addIBC (IBCOpt n)
261 addIBC (IBCOpt n)
262 return (n, cty')
262 return (n, cty')
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
267+ tclift $ tfail (At fc (Elaborating "constructor " con Nothing
268+ (Msg ("Type level variable " ++ show n' ++ " is not " ++ show tn))))
265 tyIs con t | (P _ n' _, _) <- unApply t
270 tyIs con t | (P _ n' _, _) <- unApply t
266 = if n' /= tn then tclift $ tfail (At fc (Elaborating "constructor " con Nothing (Msg (show n' ++ " is not " ++ show tn))))
271 = if n' /= tn then tclift $ tfail (At fc (Elaborating "constructor " con Nothing (Msg (show n' ++ " is not " ++ show tn))))
267 else return ()
272 else return ()