fix: Use in-context environment in sorry collection #166
|
@ -148,10 +148,15 @@ structure AnnotatedGoalState where
|
||||||
Since we cannot directly merge `MetavarContext`s, we have to get creative. This
|
Since we cannot directly merge `MetavarContext`s, we have to get creative. This
|
||||||
function duplicates frozen mvars in term and tactic info nodes, and add them to
|
function duplicates frozen mvars in term and tactic info nodes, and add them to
|
||||||
the current `MetavarContext`.
|
the current `MetavarContext`.
|
||||||
|
|
||||||
|
WARNING: Behaviour is unstable when there are multiple `sorry`s. Consider using
|
||||||
|
the draft tactic instead.
|
||||||
-/
|
-/
|
||||||
@[export pantograph_frontend_sorrys_to_goal_state_m]
|
@[export pantograph_frontend_sorrys_to_goal_state_m]
|
||||||
def sorrysToGoalState (sorrys : List InfoWithContext) : MetaM AnnotatedGoalState := do
|
def sorrysToGoalState (sorrys : List InfoWithContext) : MetaM AnnotatedGoalState := do
|
||||||
|
let env := sorrys.head? >>= (·.context?) |>.map (·.env) |>.getD (← getEnv)
|
||||||
assert! !sorrys.isEmpty
|
assert! !sorrys.isEmpty
|
||||||
|
withEnv env do
|
||||||
let goalsM := sorrys.mapM λ i => do
|
let goalsM := sorrys.mapM λ i => do
|
||||||
match i.info with
|
match i.info with
|
||||||
| .ofTermInfo termInfo => do
|
| .ofTermInfo termInfo => do
|
||||||
|
|
|
@ -44,8 +44,6 @@ structure CompilationUnit where
|
||||||
messages : Array String
|
messages : Array String
|
||||||
newConstants : List Name
|
newConstants : List Name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def frontend_process_inner (args: Protocol.FrontendProcess): MainM (CR Protocol.FrontendProcessResult) := do
|
def frontend_process_inner (args: Protocol.FrontendProcess): MainM (CR Protocol.FrontendProcessResult) := do
|
||||||
let options := (← get).options
|
let options := (← get).options
|
||||||
let (fileName, file) ← match args.fileName?, args.file? with
|
let (fileName, file) ← match args.fileName?, args.file? with
|
||||||
|
@ -78,7 +76,7 @@ def frontend_process_inner (args: Protocol.FrontendProcess): MainM (CR Protocol.
|
||||||
else
|
else
|
||||||
pure []
|
pure []
|
||||||
return {
|
return {
|
||||||
env := step.after,
|
env := step.before,
|
||||||
boundary,
|
boundary,
|
||||||
invocations,
|
invocations,
|
||||||
sorrys,
|
sorrys,
|
||||||
|
|
Loading…
Reference in New Issue