Remove some workarounds for record update issues
This commit is contained in:
@@ -65,7 +65,7 @@ lspFileSource = MkFileSource $ \fc fn => do
|
|||||||
updateFile : String → String → Unit
|
updateFile : String → String → Unit
|
||||||
updateFile fn src = unsafePerformIO $ do
|
updateFile fn src = unsafePerformIO $ do
|
||||||
st <- readIORef state
|
st <- readIORef state
|
||||||
modifyIORef state $ \a => [ files $= updateMap fn src ] a
|
modifyIORef state [ files $= updateMap fn src ]
|
||||||
let st = the LSPState $ [ files $= updateMap fn src ] st
|
let st = the LSPState $ [ files $= updateMap fn src ] st
|
||||||
-- module relative to base
|
-- module relative to base
|
||||||
|
|
||||||
@@ -75,9 +75,7 @@ updateFile fn src = unsafePerformIO $ do
|
|||||||
|
|
||||||
Right (ctx,_) <- (invalidateModule modName).runM st.topContext
|
Right (ctx,_) <- (invalidateModule modName).runM st.topContext
|
||||||
| _ => writeIORef state st
|
| _ => writeIORef state st
|
||||||
-- TODO It doesn't have record type, but eta expanding resolves this. See if there is a quick fix.
|
modifyIORef state [ topContext := ctx ]
|
||||||
-- modifyIORef state [ topContext := ctx ]
|
|
||||||
modifyIORef state $ \a => [ topContext := ctx ] a
|
|
||||||
|
|
||||||
|
|
||||||
fcToRange : FC → Json
|
fcToRange : FC → Json
|
||||||
@@ -139,7 +137,7 @@ checkFile fn = unsafePerformIO $ do
|
|||||||
putStrLn $ showError "" err
|
putStrLn $ showError "" err
|
||||||
pure $ jsonToJObject $ JsonArray $ errorToDiag err :: Nil
|
pure $ jsonToJObject $ JsonArray $ errorToDiag err :: Nil
|
||||||
-- Cache loaded modules
|
-- Cache loaded modules
|
||||||
modifyIORef state $ \a => [ topContext := top ] a
|
modifyIORef state $ [ topContext := top ]
|
||||||
pure $ jsonToJObject $ JsonArray json
|
pure $ jsonToJObject $ JsonArray json
|
||||||
|
|
||||||
-- This seems like a hack, but it works.
|
-- This seems like a hack, but it works.
|
||||||
|
|||||||
@@ -118,8 +118,8 @@ isCandidate ty (App fc t u) = isCandidate ty t
|
|||||||
isCandidate _ _ = False
|
isCandidate _ _ = False
|
||||||
|
|
||||||
setMetaMode : MetaMode → M Unit
|
setMetaMode : MetaMode → M Unit
|
||||||
-- ideally we could do metaCtx.mcmode := CheckFirst
|
-- ideally we would support dotted paths like metaCtx.mcmode := CheckFirst
|
||||||
setMetaMode mcmode = modifyTop $ \top => [ metaCtx := [mcmode := mcmode] (top.metaCtx) ] top
|
setMetaMode mcmode = modifyTop [ metaCtx $= [mcmode := mcmode] ]
|
||||||
|
|
||||||
findMatches : Context -> Val -> List (QName × Tm) -> M (List QName)
|
findMatches : Context -> Val -> List (QName × Tm) -> M (List QName)
|
||||||
findMatches ctx ty Nil = pure Nil
|
findMatches ctx ty Nil = pure Nil
|
||||||
@@ -632,7 +632,7 @@ freshMeta ctx fc ty kind = do
|
|||||||
let autos = case kind of
|
let autos = case kind of
|
||||||
AutoSolve => qn :: mc.autos
|
AutoSolve => qn :: mc.autos
|
||||||
_ => mc.autos
|
_ => mc.autos
|
||||||
modifyTop $ \top => [metaCtx := MC (updateMap qn newmeta mc.metas) autos (1 + mc.next) mc.mcmode ] top
|
modifyTop [metaCtx := MC (updateMap qn newmeta mc.metas) autos (1 + mc.next) mc.mcmode ]
|
||||||
-- I tried checking Auto immediately if CheckAll, but there isn't enough information yet.
|
-- I tried checking Auto immediately if CheckAll, but there isn't enough information yet.
|
||||||
pure $ applyBDs 0 (Meta fc qn) ctx.bds
|
pure $ applyBDs 0 (Meta fc qn) ctx.bds
|
||||||
where
|
where
|
||||||
@@ -1384,9 +1384,13 @@ undo prev ((DoArrow fc left right alts) :: xs) = do
|
|||||||
(RLam fc (BI fc nm Explicit Many) rest) Explicit
|
(RLam fc (BI fc nm Explicit Many) rest) Explicit
|
||||||
|
|
||||||
|
|
||||||
-- REVIEW do we want to let arg?
|
-- REVIEW should `arg` be assigned to a variable with `RLet`?
|
||||||
-- collect fields and default assignment
|
-- REVIEW a case statement to destruct the record instead of projections
|
||||||
-- subst in real assignment
|
-- would make less work for the compiler / inliner.
|
||||||
|
|
||||||
|
-- updateRec makes a list of fields and a term for the current value (collect), swaps in
|
||||||
|
-- any updates present in the code (doClause), and generates an application of the
|
||||||
|
-- constructor.
|
||||||
updateRec : Context → FC → List UpdateClause → Maybe Raw → Val → M Tm
|
updateRec : Context → FC → List UpdateClause → Maybe Raw → Val → M Tm
|
||||||
updateRec ctx fc clauses arg ty = do
|
updateRec ctx fc clauses arg ty = do
|
||||||
((QN _ conname), args) <- getTele arg ty
|
((QN _ conname), args) <- getTele arg ty
|
||||||
|
|||||||
Reference in New Issue
Block a user