Add missing import in vscode, fix add missing cases at EOF
Some checks failed
Publish Playground / build (push) Has been cancelled
Publish Playground / deploy (push) Has been cancelled

This commit is contained in:
2026-02-07 22:23:45 -08:00
parent 83e4adb45b
commit d36f6ddacb
5 changed files with 44 additions and 7 deletions

View File

@@ -1546,6 +1546,9 @@ infer ctx tm@(RUpdateRec fc _ _) = do
infer ctx (RVar fc nm) = go 0 ctx.types
where
entryNS : TopEntry String
entryNS (MkEntry fc (QN ns _) _ _ _) = joinBy "." ns
go : Int -> List (String × Val) -> M (Tm × Val)
go i Nil = do
top <- getTop
@@ -1554,7 +1557,13 @@ infer ctx (RVar fc nm) = go 0 ctx.types
debug $ \ _ => "lookup \{show name} as \{show def}"
vty <- eval Nil ty
pure (Ref fc name, vty)
Nothing => error fc "\{show nm} not in scope"
Nothing => do
let mods = map entryNS $ lookupAll nm top
let extra = case mods of
Nil => ""
-- For the benefit of the editor, but only sees transitive modules
_ => ", try importing: \{joinBy ", " mods}"
error fc "\{show nm} not in scope\{extra}"
go i ((x, ty) :: xs) = if x == nm then pure (Bnd fc i, ty)
else go (i + 1) xs