leanprover / lean4

Lean 4 programming language and theorem prover
https://lean-lang.org
Apache License 2.0
3.88k stars 329 forks source link

Unexpected token `mutual` after docstring comment #4156

Open ionathanch opened 2 weeks ago

ionathanch commented 2 weeks ago

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

A comment block followed by a mutual block doesn't type check, possibly doesn't parse at all either

Steps to Reproduce

/-- T --/

mutual
inductive T where
end

Expected behavior: Code successfully type checks

Actual behavior: Errors with the following message:

unexpected token 'mutual'; expected '#guard_msgs', 'abbrev', 'add_decl_doc', 'axiom', 'binder_predicate', 'builtin_dsimproc', 'builtin_dsimproc_decl', 'builtin_initialize', 'builtin_simproc', 'builtin_simproc_decl', 'class', 'declare_simp_like_tactic', 'declare_syntax_cat', 'def', 'dsimproc', 'dsimproc_decl', 'elab', 'elab_rules', 'example', 'inductive', 'infix', 'infixl', 'infixr', 'initialize', 'instance', 'macro', 'macro_rules', 'notation', 'opaque', 'postfix', 'prefix', 'simproc', 'simproc_decl', 'structure', 'syntax', 'theorem' or 'unif_hint'

Versions

4.8.0-rc1, as well as Lean nightly at https://live.lean-lang.org/#project=lean-nightly

nomeata commented 2 weeks ago

Note that you wrote not a normal comment /- but a docstring /--, and docstrings only make sense preceding a declaration. This is probably good, but the error message could be better!