Skip to content

Commit

Permalink
fix: show expected type in term goal
Browse files Browse the repository at this point in the history
  • Loading branch information
gebner authored and leodemoura committed Jun 7, 2021
1 parent 960cfd9 commit f5f9be1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Lean/Server/FileWorker.lean
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ section RequestHandling
for t in snap.cmdState.infoState.trees do
if let some (ci, Info.ofTermInfo i) := t.termGoalAt? hoverPos then
let goal ← ci.runMetaM i.lctx <| open Meta in do
let ty ← instantiateMVars <|<- inferType i.expr
let ty ← instantiateMVars <| i.expectedType?.getD (← inferType i.expr)
withPPInaccessibleNames <| Meta.ppGoal (← mkFreshExprMVar ty).mvarId!
let range := if hasRange i.stx then rangeOfSyntax! text i.stx else ⟨p.position, p.position⟩
return some { goal := toString goal, range }
Expand Down
6 changes: 3 additions & 3 deletions tests/lean/interactive/plainTermGoal.lean.expected.out
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"position": {"line": 2, "character": 29}}
{"range":
{"start": {"line": 2, "character": 28}, "end": {"line": 2, "character": 46}},
"goal": "⊢ 1 < Nat.succ 1"}
"goal": "⊢ 1 < 2"}
{"textDocument": {"uri": "file://plainTermGoal.lean"},
"position": {"line": 2, "character": 44}}
{"range":
Expand All @@ -27,7 +27,7 @@
"position": {"line": 11, "character": 10}}
{"range":
{"start": {"line": 11, "character": 10}, "end": {"line": 11, "character": 18}},
"goal": "y : Int\n⊢ Nat"}
"goal": "y : Int\n⊢ OptionM Nat"}
{"textDocument": {"uri": "file://plainTermGoal.lean"},
"position": {"line": 16, "character": 16}}
{"range":
Expand Down Expand Up @@ -57,4 +57,4 @@
"position": {"line": 31, "character": 8}}
{"range":
{"start": {"line": 31, "character": 8}, "end": {"line": 31, "character": 24}},
"goal": "n : Nat\n⊢ n < Nat.succ n"}
"goal": "n : Nat\n⊢ n < n + 1"}

0 comments on commit f5f9be1

Please sign in to comment.