fix: panic when Syntax.missing

I got a panic error message today in VS Code because of this function.
It is weird because, as far as I can tell, this function is only used by
the `register_simp_attr` macro, and this macro was not being used in
the files I was editing.
I think the fix is resonable for a `Syntax.missing` case.

cc @gebner
This commit is contained in:
Leonardo de Moura 2022-09-12 16:10:14 -07:00
parent 506cf01d94
commit a2631ce037

View file

@ -95,6 +95,7 @@ def getDocStringText [Monad m] [MonadError m] [MonadRef m] (stx : TSyntax `Lean.
def TSyntax.getDocString (stx : TSyntax `Lean.Parser.Command.docComment) : String :=
match stx.raw[1] with
| Syntax.atom _ val => val.extract 0 (val.endPos - ⟨2⟩)
| Syntax.missing => ""
| _ => panic! s!"unexpected doc string\n{stx.raw[1]}"
end Lean