chore: Version 0.3 #136
|
@ -312,6 +312,8 @@ structure FrontendProcess where
|
|||
invocations: Bool := false
|
||||
-- If set to true, collect `sorry`s
|
||||
sorrys: Bool := false
|
||||
-- If set to true, extract new constants
|
||||
newConstants: Bool := false
|
||||
deriving Lean.FromJson
|
||||
structure InvokedTactic where
|
||||
goalBefore: String
|
||||
|
@ -332,6 +334,7 @@ structure CompilationUnit where
|
|||
-- Code segments which generated the goals
|
||||
goalSrcBoundaries: Array (Nat × Nat) := #[]
|
||||
messages: Array String := #[]
|
||||
newConstants: Option (Array String) := .none
|
||||
deriving Lean.ToJson
|
||||
structure FrontendProcessResult where
|
||||
units: List CompilationUnit
|
||||
|
|
13
Repl.lean
13
Repl.lean
|
@ -262,9 +262,17 @@ def execute (command: Protocol.Command): MainM Lean.Json := do
|
|||
else
|
||||
pure []
|
||||
let messages ← step.messageStrings
|
||||
return (step.before, boundary, invocations?, sorrys, messages)
|
||||
let newConstants ← if args.newConstants then
|
||||
Frontend.collectNewDefinedConstants step
|
||||
else
|
||||
pure []
|
||||
return (step.before, boundary, invocations?, sorrys, messages, newConstants)
|
||||
let li ← frontendM.run context |>.run' state
|
||||
let units ← li.mapM λ (env, boundary, invocations?, sorrys, messages) => Lean.withEnv env do
|
||||
let units ← li.mapM λ (env, boundary, invocations?, sorrys, messages, newConstants) => Lean.withEnv env do
|
||||
let newConstants := if args.newConstants then
|
||||
.some $ newConstants.toArray.map λ name => name.toString
|
||||
else
|
||||
.none
|
||||
let (goalStateId?, goals, goalSrcBoundaries) ← if sorrys.isEmpty then do
|
||||
pure (.none, #[], #[])
|
||||
else do
|
||||
|
@ -279,6 +287,7 @@ def execute (command: Protocol.Command): MainM Lean.Json := do
|
|||
goals,
|
||||
goalSrcBoundaries,
|
||||
messages,
|
||||
newConstants,
|
||||
}
|
||||
return .ok { units }
|
||||
catch e =>
|
||||
|
|
|
@ -174,6 +174,7 @@ def test_frontend_process : Test :=
|
|||
("file", .str file),
|
||||
("invocations", .bool true),
|
||||
("sorrys", .bool false),
|
||||
("newConstants", .bool false),
|
||||
]
|
||||
({
|
||||
units := [{
|
||||
|
@ -214,6 +215,7 @@ def test_frontend_process_sorry : Test :=
|
|||
("file", .str file),
|
||||
("invocations", .bool false),
|
||||
("sorrys", .bool true),
|
||||
("newConstants", .bool false),
|
||||
]
|
||||
({
|
||||
units := [{
|
||||
|
|
Loading…
Reference in New Issue