chore: fix stdlib

This commit is contained in:
Leonardo de Moura 2021-08-06 12:58:58 -07:00
parent 818466785a
commit 1be41f2adb
3 changed files with 14 additions and 11 deletions

View file

@ -32,8 +32,10 @@ private partial def floatOutAntiquotTerms : Syntax → StateT (Syntax → TermEl
| stx => pure stx
private def getSepFromSplice (splice : Syntax) : Syntax := do
let Syntax.atom _ sep ← getAntiquotSpliceSuffix splice | unreachable!
Syntax.mkStrLit (sep.dropRight 1)
if let Syntax.atom _ sep := getAntiquotSpliceSuffix splice then
Syntax.mkStrLit (sep.dropRight 1)
else
unreachable!
partial def mkTuple : Array Syntax → TermElabM Syntax
| #[] => `(Unit.unit)

View file

@ -195,14 +195,15 @@ structure GoalsAtResult where
partial def InfoTree.goalsAt? (text : FileMap) (t : InfoTree) (hoverPos : String.Pos) : List GoalsAtResult := do
t.deepestNodes fun
| ctx, i@(Info.ofTacticInfo ti), cs => OptionM.run do
let (some pos, some tailPos) ← pure (i.pos?, i.tailPos?)
| failure
let trailSize := i.stx.getTrailingSize
-- show info at EOF even if strictly outside token + trail
let atEOF := tailPos == text.source.bsize
guard <| pos ≤ hoverPos ∧ (hoverPos < tailPos + trailSize || atEOF)
return { ctxInfo := ctx, tacticInfo := ti, useAfter :=
hoverPos > pos && (hoverPos >= tailPos || !cs.any (hasNestedTactic pos tailPos)) }
if let (some pos, some tailPos) := (i.pos?, i.tailPos?) then
let trailSize := i.stx.getTrailingSize
-- show info at EOF even if strictly outside token + trail
let atEOF := tailPos == text.source.bsize
guard <| pos ≤ hoverPos ∧ (hoverPos < tailPos + trailSize || atEOF)
return { ctxInfo := ctx, tacticInfo := ti, useAfter :=
hoverPos > pos && (hoverPos >= tailPos || !cs.any (hasNestedTactic pos tailPos)) }
else
failure
| _, _, _ => none
where
hasNestedTactic (pos tailPos) : InfoTree → Bool

View file

@ -16,7 +16,7 @@ inductive Source where
namespace Source
def fromToml (v : Toml.Value) : Option Source :=
def fromToml (v : Toml.Value) : OptionM Source :=
(do let Toml.Value.str dir ← v.lookup "path" | none
path ⟨dir⟩) <|>
(do let Toml.Value.str url ← v.lookup "git" | none