Skip to content

Commit

Permalink
feat: show documentation for Quot primitives (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
cppio authored Dec 19, 2024
1 parent 70fca3c commit 9c324ad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 0 additions & 4 deletions DocGen4/Process/Base.lean
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ structure TheoremInfo extends Info
Information about an `opaque` declaration.
-/
structure OpaqueInfo extends Info where
/--
The pretty printed value of the declaration.
-/
value : CodeWithInfos
/--
A value of partial is interpreted as this opaque being part of a partial def
since the actual definition for a partial def is hidden behind an inaccessible value.
Expand Down
4 changes: 2 additions & 2 deletions DocGen4/Process/DocInfo.lean
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ def ofConstant : (Name × ConstantInfo) → MetaM (Option DocInfo) := fun (name,
| ConstantInfo.ctorInfo i =>
let info ← Info.ofConstantVal i.toConstantVal
return some <| ctorInfo { info with render := false }
-- we ignore these for now
| ConstantInfo.recInfo _ | ConstantInfo.quotInfo _ => return none
| ConstantInfo.quotInfo i => return some <| opaqueInfo (← OpaqueInfo.ofQuotVal i)
| ConstantInfo.recInfo _ => return none

def getKindDescription : DocInfo → String
| axiomInfo i => if i.isUnsafe then "unsafe axiom" else "axiom"
Expand Down
9 changes: 7 additions & 2 deletions DocGen4/Process/OpaqueInfo.lean
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ open Lean Meta

def OpaqueInfo.ofOpaqueVal (v : OpaqueVal) : MetaM OpaqueInfo := do
let info ← Info.ofConstantVal v.toConstantVal
let value ← prettyPrintTerm v.value
let env ← getEnv
let isPartial := env.find? (Compiler.mkUnsafeRecName v.name) |>.isSome
let definitionSafety :=
Expand All @@ -26,8 +25,14 @@ def OpaqueInfo.ofOpaqueVal (v : OpaqueVal) : MetaM OpaqueInfo := do
DefinitionSafety.safe
return {
toInfo := info,
value,
definitionSafety
}

def OpaqueInfo.ofQuotVal (v : QuotVal) : MetaM OpaqueInfo := do
let info ← Info.ofConstantVal v.toConstantVal
return {
toInfo := info
definitionSafety := .safe
}

end DocGen4.Process

0 comments on commit 9c324ad

Please sign in to comment.