improve already defined error messages
This commit is contained in:
@@ -80,10 +80,6 @@ step mach@(M a b c mem ip out) =
|
|||||||
combo 6 = c
|
combo 6 = c
|
||||||
combo n = itobi n
|
combo n = itobi n
|
||||||
|
|
||||||
find : ∀ a. (a → Bool) → List a → Maybe a
|
|
||||||
find f Nil = Nothing
|
|
||||||
find f (x :: xs) = if f x then Just x else find f xs
|
|
||||||
|
|
||||||
Cand : U
|
Cand : U
|
||||||
Cand = BigInt × SnocList Int × List Int
|
Cand = BigInt × SnocList Int × List Int
|
||||||
|
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ processDecl (TypeSig fc names tm) = do
|
|||||||
let mstart = length mc.metas
|
let mstart = length mc.metas
|
||||||
for_ names $ \nm => do
|
for_ names $ \nm => do
|
||||||
let Nothing := lookup nm top
|
let Nothing := lookup nm top
|
||||||
| _ => error fc "\{show nm} is already defined"
|
| Just entry => error fc "\{show nm} is already defined at \{show entry.fc}"
|
||||||
pure ()
|
pure ()
|
||||||
ty <- check (mkCtx fc) tm (VU fc)
|
ty <- check (mkCtx fc) tm (VU fc)
|
||||||
ty <- zonk top 0 [] ty
|
ty <- zonk top 0 [] ty
|
||||||
@@ -241,7 +241,7 @@ processDecl (Def fc nm clauses) = do
|
|||||||
let Just entry = lookup nm top
|
let Just entry = lookup nm top
|
||||||
| Nothing => throwError $ E fc "No declaration for \{nm}"
|
| Nothing => throwError $ E fc "No declaration for \{nm}"
|
||||||
let (MkEntry fc name ty Axiom) := entry
|
let (MkEntry fc name ty Axiom) := entry
|
||||||
| _ => throwError $ E fc "\{nm} already defined"
|
| _ => throwError $ E fc "\{nm} already defined at \{show entry.fc}"
|
||||||
|
|
||||||
putStrLn "check \{nm} at \{pprint [] ty}"
|
putStrLn "check \{nm} at \{pprint [] ty}"
|
||||||
vty <- eval empty CBN ty
|
vty <- eval empty CBN ty
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ setDef name fc ty def = do
|
|||||||
where
|
where
|
||||||
go : List TopEntry -> M (List TopEntry)
|
go : List TopEntry -> M (List TopEntry)
|
||||||
go [] = pure $ [MkEntry fc name ty def]
|
go [] = pure $ [MkEntry fc name ty def]
|
||||||
go (x@(MkEntry _ nm ty' def') :: defs) = if nm == name
|
go (x@(MkEntry fc' nm ty' def') :: defs) = if nm == name
|
||||||
then error fc "\{name} is already defined"
|
then error fc "\{name} is already defined at \{show fc'}"
|
||||||
else (x ::) <$> go defs
|
else (x ::) <$> go defs
|
||||||
|
|
||||||
public export
|
public export
|
||||||
|
|||||||
Reference in New Issue
Block a user