Skip to content

Commit fbfe62b

Browse files
committed
use withTermInfoContext' inside withInfoHole to prevent the custom info to override the term info
1 parent 6c5afe9 commit fbfe62b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/Lean/Elab/SyntheticMVars.lean

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ private def resumePostponed (savedContext : SavedContext) (stx : Syntax) (mvarId
3737
let mvarDecl ← getMVarDecl mvarId
3838
let expectedType ← instantiateMVars mvarDecl.type
3939
withInfoHole mvarId do
40-
let result ← resumeElabTerm stx expectedType (!postponeOnError)
41-
/- We must ensure `result` has the expected type because it is the one expected by the method that postponed stx.
42-
That is, the method does not have an opportunity to check whether `result` has the expected type or not. -/
43-
let result ← withRef stx <| ensureHasType expectedType result
40+
let result ← withTermInfoContext' .anonymous stx do
41+
let result ← resumeElabTerm stx expectedType (!postponeOnError)
42+
/- We must ensure `result` has the expected type because it is the one expected by the method that postponed stx.
43+
That is, the method does not have an opportunity to check whether `result` has the expected type or not. -/
44+
withRef stx <| ensureHasType expectedType result
4445
/- We must perform `occursCheck` here since `result` may contain `mvarId` when it has synthetic `sorry`s. -/
4546
if (← occursCheck mvarId result) then
4647
mvarId.assign result

0 commit comments

Comments
 (0)