Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show documentation for Quot primitives #251

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading