lean4-htt/tests/lean/run/ppMaxSteps.lean
Kyle Miller 49249b9107
feat: introduce pp.maxSteps (#4556)
The `pp.maxSteps` option is a hard limit on the complexity of pretty
printer output, which is necessary to prevent the LSP from crashing when
there are accidental large terms. We're using the default value from the
corresponding Lean 3 option.

This PR also sets `pp.deepTerms` to `false` by default.
2024-06-24 19:19:45 +00:00

35 lines
840 B
Text

/-!
# Testing `pp.maxSteps`
-/
/-!
Without setting `pp.maxSteps`, the goal would crash the LSP when trying to create very large JSON.
-/
opaque myAuxiliaryFunction : Nat → Nat → Nat
opaque anotherHelper : Nat → Nat
def f (m : Nat) : Nat → Nat
| 0 => anotherHelper m
| n+1 => myAuxiliaryFunction (f (anotherHelper m) n) (f (myAuxiliaryFunction m (anotherHelper m)) n)
set_option pp.maxSteps 10
/--
error: unsolved goals
a b : Nat
⊢ myAuxiliaryFunction
(myAuxiliaryFunction
(myAuxiliaryFunction
(myAuxiliaryFunction
(myAuxiliaryFunction
(myAuxiliaryFunction (myAuxiliaryFunction (myAuxiliaryFunction (myAuxiliaryFunction ⋯ ⋯) ⋯) ⋯) ⋯) ⋯)
⋯)
⋯)
⋯)
⋯ =
-/
#guard_msgs in
example : f a 10 = b := by
simp [f]