lean4-htt/tests/lean/caseSuggestions.lean
David Christiansen b0b922bae4 feat: list the valid case tags when the user writes an invalid one
Before, Lean would simply emit the message "tag not found". With this
change, it also tells the user what they could have written that would
be accepted.
2023-10-06 11:14:21 +02:00

45 lines
954 B
Text

/-!
# Provide case alternatives in "nonexistent tag" message
Test that the available case tags are suggested when a nonexistent
tag is requested. -/
/-!
This example tests what happens when no cases are available. -/
theorem noCases : Nat := by
case nonexistent =>
skip
/-!
This example tests what happens when just one case is available, but
it wasn't picked. -/
theorem oneCase : Nat := by
cases ()
case nonexistent =>
skip
/-!
Check varying numbers of cases to make sure the pretty-print setup for
the list is correct. -/
theorem twoCases : Nat := by
cases true
case nonexistent =>
skip
theorem fourCases : Nat := by
cases true <;> cases true
case nonexistent =>
skip
theorem eightCases : Nat := by
cases true <;> cases true <;> cases true
case nonexistent =>
skip
theorem sixteenCases : Nat := by
cases true <;> cases true <;> cases true <;> cases true
case nonexistent =>
skip