fix: have Lean.Meta.ppGoal use hard newlines (#5640)

This function uses soft newlines in many places where hard newlines are
more appropriate. Pointed out by @gebner in #1967.
This commit is contained in:
Kyle Miller 2024-10-08 10:36:08 -07:00 committed by GitHub
parent b2b450d7cb
commit f1d3527fe8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 4 deletions

View file

@ -33,7 +33,7 @@ register_builtin_option pp.showLetValues : Bool := {
}
private def addLine (fmt : Format) : Format :=
if fmt.isNil then fmt else fmt ++ Format.line
if fmt.isNil then fmt else fmt ++ "\n"
def getGoalPrefix (mvarDecl : MetavarDecl) : String :=
if isLHSGoal? mvarDecl.type |>.isSome then
@ -99,6 +99,6 @@ def ppGoal (mvarId : MVarId) : MetaM Format := do
let fmt := fmt ++ getGoalPrefix mvarDecl ++ Format.nest indent typeFmt
match mvarDecl.userName with
| Name.anonymous => return fmt
| name => return "case " ++ format name.eraseMacroScopes ++ Format.line ++ fmt
| name => return "case " ++ format name.eraseMacroScopes ++ "\n" ++ fmt
end Lean.Meta

View file

@ -8,4 +8,5 @@ Tactic is run (ideally only twice, in most general context)
Tactic is run (ideally only twice, in most general context)
n : Nat
⊢ n < n.succ
n m : Nat ⊢ n < n.succ
n m : Nat
⊢ n < n.succ

View file

@ -8,7 +8,12 @@ h1 : x ≠ 0
h2 : y ≠ 0
h3 : x = y
⊢ x ≠ 0
case simp.discharger x y : Nat h1 : x ≠ 0 h2 : y ≠ 0 h3 : x = y ⊢ y ≠ 0
case simp.discharger
x y : Nat
h1 : x ≠ 0
h2 : y ≠ 0
h3 : x = y
⊢ y ≠ 0
x y : Nat
h1 : x ≠ 0
h2 : y ≠ 0