I think I have case expressions compiling

This commit is contained in:
2024-09-05 21:50:15 -07:00
parent 24ce520680
commit 1d1dd678c3
8 changed files with 78 additions and 18 deletions

View File

@@ -93,6 +93,7 @@ parameters (ctx: Context)
-- we don't allow solutions with Case in them
-- pure (Case fc !(go ren lvl sc) alts)
go ren lvl (VLit fc lit) = pure (Lit fc lit)
go ren lvl (VLet fc {}) = error fc "rename Let not implemented"
lams : Nat -> Tm -> Tm
lams 0 tm = tm
@@ -498,8 +499,11 @@ check ctx tm ty = case (tm, !(forceType ty)) of
let ctx' = extend ctx scnm scty
cons <- getConstructors ctx' scty
alts <- traverse (buildCase ctx' (MkProb clauses ty) scnm scty) cons
-- BROKEN, need scnm in scope for real. ctx' promises it, but we don't have a binder here
pure $ Let fc scnm sc $ Case fc (Bnd fc 0) alts
pure $ Case fc sc alts
-- buildTree ctx (MkProb{})
-- ?hole