Compare commits

...

2 Commits

Author SHA1 Message Date
Leni Aniva 976646fb67
chore: Use repeat-break structure 2025-01-24 19:11:05 -08:00
Leni Aniva 418d630255
fix: Remove unused variable 2025-01-24 19:06:07 -08:00
2 changed files with 3 additions and 4 deletions

View File

@ -23,10 +23,10 @@ def parseCommand (s: String): Except String Command := do
return { cmd := s.take offset, payload := payload }
| .none => throw "Command is empty"
partial def loop : MainM Unit := do
partial def loop : MainM Unit := do repeat do
let state ← get
let command ← (← IO.getStdin).getLine
if command.trim.length = 0 then return ()
if command.trim.length = 0 then break
match parseCommand command with
| .error error =>
let error := Lean.toJson ({ error := "command", desc := error }: InteractionError)
@ -43,7 +43,6 @@ partial def loop : MainM Unit := do
let message ← e.toMessageData.toString
let error := Lean.toJson ({ error := "main", desc := message }: InteractionError)
IO.println error.compress
loop
unsafe def main (args: List String): IO Unit := do

View File

@ -110,7 +110,7 @@ def test_symbol_location : TestT IO Unit := do
checkTrue "file" result.sourceUri?.isNone
checkEq "pos" (result.sourceStart?.map (·.column)) <| .some 0
checkEq "pos" (result.sourceEnd?.map (·.column)) <| .some 88
let .ok { imports, constNames, extraConstNames } ← Environment.moduleRead ⟨"Init.Data.Nat.Basic"⟩ | fail "Module read failed"
let .ok { imports, constNames, .. } ← Environment.moduleRead ⟨"Init.Data.Nat.Basic"⟩ | fail "Module read failed"
checkEq "imports" imports #["Init.SimpLemmas", "Init.Data.NeZero"]
checkTrue "constNames" $ constNames.contains "Nat.succ_add"