Skip to content

Commit 2c5dd35

Browse files
committed
Mini hack to get right JSon fields
1 parent 5c602f2 commit 2c5dd35

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

LeanUtils/Utils.lean

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,26 @@ def visitSorryNode {Out} (ctx : ContextInfo) (node : Info)
4242
else return none
4343
| _ => return none
4444

45+
/-- This is a hack to get the right constructor names (to match those we get
46+
from using a REPL based sorry extraction). -/
47+
structure Location where
48+
start_line : Nat
49+
start_column : Nat
50+
deriving FromJson, ToJson, DecidableEq
51+
52+
def Lean.Position.toLocation : Position → Location := fun pos ↦ ⟨pos.line, pos.column⟩
53+
4554
structure ParsedSorry where
46-
statement : String
47-
pos : Position
55+
goal : String
56+
location : Location
4857
parentDecl : Name
4958
hash : UInt64
5059
deriving FromJson, ToJson, DecidableEq
5160

52-
def SorryData.toParsedSorry {Out} [ToString Out] (fileMap : FileMap) : SorryData Out → ParsedSorry :=
61+
def SorryData.toParsedSorry {Out} [ToString Out] (fileMap : FileMap) :
62+
SorryData Out → ParsedSorry :=
5363
fun ⟨out, stx, parentDecl⟩ =>
54-
⟨ToString.toString out, fileMap.toPosition stx.getPos?.get!, parentDecl, Hashable.hash <| ToString.toString out⟩
64+
⟨ToString.toString out, fileMap.toPosition stx.getPos?.get! |>.toLocation, parentDecl, Hashable.hash <| ToString.toString out⟩
5565

5666
instance : ToString ParsedSorry where
5767
toString a := ToString.toString <| ToJson.toJson a

0 commit comments

Comments
 (0)