Zulip Chat Archive

Stream: lean4

Topic: Confusing error message with set_option before doc comment


Geoffrey Irving (Jan 02 2024 at 15:49):

If I do

/-- A comment that should go after the `set_option` -/
set_option maxHeartbeats 10000000 in
lemma simple : 7 = 7 := rfl

I get the confusing error message

unexpected token 'set_option'; expected '#guard_msgs', 'abbrev', 'add_decl_doc', 'alias', 'axiom', 'binder_predicate', 'builtin_initialize', 'class', 'declare_config_elab', 'declare_simp_like_tactic', 'declare_syntax_cat', 'def', 'elab', 'elab_rules', 'example', 'inductive', 'infix', 'infixl', 'infixr', 'initialize', 'instance', 'irreducible_def', 'lemma', 'macro', 'macro_rules', 'notation', 'notation3', 'opaque', 'postfix', 'prefix', 'proof_wanted', 'register_builtin_option', 'register_label_attr', 'register_option', 'register_simp_attr', 'scoped', 'structure', 'syntax', 'theorem' or 'unif_hint'

After some searching, I finally realized that it was supposed to be

set_option maxHeartbeats 10000000 in
/-- A comment that should go after the `set_option` -/
lemma simple : 7 = 7 := rfl

Would it be possible for the error message to give more of a hint in that direction?

Geoffrey Irving (Jan 02 2024 at 17:04):

(deleted)

Kim Morrison (Jan 04 2024 at 00:08):

@Geoffrey Irving, could you open an issue for this?

Geoffrey Irving (Jan 04 2024 at 07:35):

^ Will do (later today)!

Geoffrey Irving (Jan 04 2024 at 09:46):

https://github.com/leanprover/lean4/issues/3135


Last updated: May 02 2025 at 03:31 UTC