Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: reorder goals after specialize (leanprover#1796)
Browse files Browse the repository at this point in the history
* fix: reorder goals after specialize

* fix test
kim-em authored and digama0 committed Nov 30, 2022
1 parent f86c13e commit a808286
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Lean/Elab/Tactic/ElabTerm.lean
Original file line number Diff line number Diff line change
@@ -174,7 +174,7 @@ def refineCore (stx : Syntax) (tagSuffix : Name) (allowNaturalHoles : Bool) : Ta
let mvarId ← (← getMainGoal).assert localDecl.userName (← inferType e).headBeta e
let (_, mvarId) ← mvarId.intro1P
let mvarId ← mvarId.tryClear h.fvarId!
replaceMainGoal (mvarId :: mvarIds')
replaceMainGoal (mvarIds' ++ [mvarId])
else
throwError "'specialize' requires a term of the form `h x_1 .. x_n` where `h` appears in the local context"
| _ => throwUnsupportedSyntax
2 changes: 1 addition & 1 deletion tests/lean/run/specialize1.lean
Original file line number Diff line number Diff line change
@@ -20,9 +20,9 @@ example (X : Type) [Add X] (f : forall {A : Type} [Add A], A → A → A) (x : X

def ex (f : Nat → Nat → Nat) : Nat := by
specialize f _ _
exact f
exact 10
exact 2
exact f

example : ex (· - ·) = 8 :=
rfl

0 comments on commit a808286

Please sign in to comment.